linux命令

linux命令

bash shell 命令基本格式

cmd [option] arguments

Ubuntu下安装卸载

软件的命名:
软件名_软件版本-修订版本_体系结构.deb
dpkg方式

特点
离线安装,需要安装的软件包必须实现下载好。无法解决软件包的依赖关系。
安装
sudo dpkg -i 软件包
卸载
sudo dpkg -P 软件名(完全卸载)

apt方式

特点
支持在线安装,自动检查软件包的依赖关系。如果依赖的软件包不存在,会自动下载并且完成安装。
apt安装步骤
1.从/var/lib/apt/lists 读取索引文件
2.完成在线下载,软件包存放路径/var/cache/apt/archives/
3.完成安装
安装
sudo apt-get install 软件名
卸载
sudo apt-get –purge remove 软件包名(完全卸载)
更新索引文件
sudo apt-get update

打补丁

打补丁

1.diff -ruN old(旧版本) new(新版本) > diff.txt

diff.txt    生成补丁文件
r           递归子目录
u           保证补丁文件格式一致
N           保证补丁文件能够正确修改
  1. cd old/
  2. patch -pl < ../diff.txt 开始打补丁
取消打补丁

patch -Rpl < ../diff.txt

压缩和打包

压缩
gzip file.gz  
bzip2 file.bz2  
解压
gunzip file.gz
bunzip2 file.bz2
打包
tar czvf dir.tar.gz dir/
解包
tar xzvf dir.tar.gz
说明
-c  创建
-x  释放
-z  使用gzip
-j  使用bzip2
-v  显示执行过程
-f  指定文件名

帐户管理

切换用户
su 用户名
退出
exit
添加新用户
adduser 用户名
删除用户
deluser 用户名

常用命令

pwd

显示当前绝对路径

ls

查看本目录下文件

ls -l   //查看详细信息
ls -a   //查看隐藏文件
file
file 文件名    //查看文件类型
history
history 10 //显示最近10条历史命令
history -c //清除历史命令记录
alias
alias 别名='命令'       //给命令取别名
unalias 别名='取消别名' //取消别名

永久修改
    在家目录下.bashrc文件中添加
        alias 别名='命令'
    配置文件立即生效
        source .bashrc
touch
touch 文件名   //(1)更新时间戳(2)若文件不存在,则创建
wc
wc -c   //统计字符个数
wc -w   //统计单词个数
wc -l   //统计行数
uname
uname -r    //显示操作系统发行版本号
uname -a    //显示关于操作系统的多个信息

PS.
uname -r 重用在驱动的Makefile中
/lib/modules/$(shell uname -r)/build
这里的build是一个软连接文件
cat
cat 文件名         //在终端打印文件
tac 文件名         //倒序显示
cat -n 文件名  //显示行号
head 和 tail
head -数字n 文件名       //显示文件的前n行
tail -数字n 文件名       //显示文件的后n行
echo
echo 字符串        //字符串前的空格,全部忽略
echo "字符串"      //双引号中的空格,不能忽略
find
find 路径 -name 文件名   
//搜索指定路径下是否有名字为“文件名”的文件
grep
grep "字符串" 文件名 路径 -n -R//查找字符串
-n      //显示行号
-R      //进入子目录
例:
    grep "string" * ~/Desktop -nR
cut
cut     //截取字符段
-d      //指定分隔符
-f      //指定需要截取的字符段
1,2,3   //截取第1,2,3个字符段
例:
    cut -d "分隔符" -f 1,2,3
ps
ps      //查看系统进程信息
ps -ef  //查看更详细的信息
top

动态查看

kill

发送信号

kill -9 PID 强制杀死进程
df -h

查看硬盘空间

man

man 手册查询

du -sh 目录/

查看目录大小

ln

创建链接文件

ln 源文件 目标文件         //硬链接文件
ln -s 源文件 目标文件  //软连接文件
  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Linux命令大全完整版 目 录 目 录 I 1. linux系统管理命令 1 adduser 1 chfn(change finger information) 1 chsh(change shell) 1 date 2 exit 3 finger 4 free 5 fwhois 5 gitps(gnu interactive tools process status) 5 groupdel(group delete) 6 groupmod(group modify) 6 halt 7 id 7 kill 8 last 8 lastb 8 login 9 logname 9 logout 9 logrotate 9 newgrp 10 nice 10 procinfo(process information) 11 ps(process status) 11 pstree(process status tree) 14 reboot 15 renice 15 rlogin(remote login) 16 rsh(remote shell) 16 rwho 16 screen 17 shutdown 17 sliplogin 18 su(super user) 18 sudo 19 suspend 19 swatch(simple watcher) 20 tload 20 top 21 uname 21 useradd 22 userconf 22 userdel 23 usermod 23 vlock(virtual console lock) 24 w 24 who 25 whoami 25 whois 25 2. linux系统设置命令 27 alias 27 apmd(advanced power management BIOS daemon) 27 aumix(audio mixer) 27 bind 29 chkconfig(check config) 29 chroot(change root) 30 clock 30 crontab 31 declare 31 depmod(depend module) 32 dircolors 32 dmesg 33 enable 33 eval 33 export 33 fbset(frame buffer setup) 34 grpconv(group convert to shadow password) 35 grpunconv(group unconvert from shadow password) 35 hwclock(hardware clock) 35 insmod(install module) 36 kbdconfig 36 lilo(linux loader) 37 liloconfig 38 lsmod(list modules) 38 minfo 38 mkkickstart 39 modinfo(module infomation) 39 modprobe(module probe) 39 mouseconfig 40 ntsysv 41 passwd(password) 41 pwconv 41 pwunconv 42 rdate(receive date) 42 resize 42 rmmod(remove module) 42 rpm(redhat package manager) 43 set 46 setconsole 47 setenv(set environment variable) 48 setup 48 sndconfig 48 SVGAText Mode 49 timeconfig 49 ulimit 50 unalias 50 unset 51 3. linux文档编辑命令 52 col 52 colrm(column remove) 52 comm(common) 52 csplit(context split) 53 ed(editor) 53 egrep 54 ex 54 fgrep(fixed regexp) 54 fmt(fromat) 54 fold 55 grep 55 ispell(interactive spelling checking) 57 jed 58 joe 58 join 60 look 61 mtype 61 pico 62 rgrep(recursive grep) 62 sed(stream editor) 63 sort 64 spell 65 tr(translate character) 65 uniq 65 wc(word count) 66 4. linux压缩备份命令 67 ar 67 bunzip2 68 bzip2 68 bzip2recover 69 compress 69 cpio(copy in/out) 70 dump 72 gunzip(gnu unzip) 73 gzexe(gzip executable) 74 gzip(gnu zip) 74 lha 75 restore 76 tar(tape archive) 77 unarj 80 unzip 81 zip 82 zipinfo 83 5.linux文件管理命令 85 diff(differential) 85 diffstat(differential status) 86 file 87 find 87 git(gnu interactive tools) 90 gitview(gnu interactie tools viewer) 91 ln(link) 91 locate 92 lsattr(list attribute) 92 mattrib 93 mc(midnight commander) 93 mcopy 94 mdel 94 mktemp 95 mmove 95 mread 95 mren 96 mshowfat 96 mtools 96 mtoolstest 96 mv 97 od(octal dump) 97 paste 98 patch 99 rcp(remote copy) 101 rhmask 101 rm(remove) 101 slocate(secure locate) 102 split 102 tee 103 tmpwatch(temporary watch) 103 touch 103 umask 104 whereis 104 which 105 cat 105 chattr(change attribute) 106 chgrp(change group) 106 chmod(change mode) 107 chown(change owner) 108 cksum(check sum) 109 cmp(compare) 109 cp(copy) 110 cut 111 indent 111 6.linux文件传输命令 115 bye 115 ftp(file transfer protocol) 115 ftpcount 115 ftpshut(ftp shutdown) 115 ftpwho 116 ncftp(nc file transfer protocol) 116 tftp(trivial file transfer protocol) 116 uucico 116 uucp 117 uupick 118 uuto 119 7. linux磁盘管理命令 120 cd(change directory) 120 df(disk free) 120 dirs 121 du(disk usage) 121 edquota(edit quota) 122 eject 122 lndir(link directory) 123 ls(list) 123 mcd 125 mdeltree 125 mdu 126 mkdir(make directories) 126 mlabel 126 mmd 127 mmount 127 mrd 127 mzip 127 pwd(print working directory) 128 quota 128 quotacheck 128 quotaoff 129 quotaon 129 repquota(report quota) 130 rmdir(remove directory) 130 rmt(remote magnetic tape) 130 stat(status) 131 Tree 131 umount 132 8. linux磁盘维护命令 133 badblocks 133 cfdisk 133 dd 134 e2fsck(ext2 file system check) 134 ext2ed(ext2 file system editor) 136 fdisk 137 fsck.ext2(file system check-second filesystem) 137 fsck(file system check) 138 fsck.minix(file system check-minix filesystem) 139 fsconf(file system configurator) 139 hdparm(hard disk parameters) 139 losetup(loop setup) 141 mbadblocks 141 mformat 141 mkbootdisk(make boot disk) 142 mkdosfs(make Dos file system) 143 mke2fs(make ext2 file system) 143 mkfs.ext2 144 mkfs(make file system) 144 mkfs.minix 145 mkfs.msdos 145 mkinitrd(make initial ramdisk images) 145 mkisofs(make iso file system) 145 mkswap 147 mpartition 148 sfdisk 148 swapoff 149 swapon 149 symlinks(symbolic links) 149 sync 150 9. linux网络通讯命令 151 dip 151 getty(get teletypewriter) 151 mingetty 152 ppp-off 152 smbd(samba daemon) 152 telnet 153 uulog 154 uustat 154 uux 155 cu(call up) 156 dnsconf(dns configurator) 157 efax 158 httpd(http daemon) 159 ifconfig 159 mesg 160 minicom 161 nc 161 netconf 162 netstat 162 ping 163 pppstats(point to point protocol status) 164 samba 164 setserial 165 shapecfg(shaper configuration) 165 smbd(samba daemon) 166 statserial(status ofserial port) 166 talk 166 Tcpdump 167 testparm(test parameter) 168 traceroute 168 tty(teletypewriter) 169 uuname 169 wall(write all) 170 write 170 ytalk 170 arpwatch(ARP watcher) 170 apachectl(Apache control interface) 171 smbclient(samba client) 171 pppsetup 172 10. linux电子邮件与新闻组命令 173 archive 173 ctlinnd(control the internet news daemon) 173 elm 173 getlist 174 inncheck(inn check) 174 mail 175 mailconf 175 mailq(mail queue) 175 messages 176 metamail 176 mutt 177 nntpget 178 pine 178 slrn 180 11. linux其他命令 181 reconfig 181 startx(start X Window) 181 xconfigurator 181 XF86Setup 182 xlsatoms 182 xlsclients 183 xlsfonts 183 yes 184

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值