系统相关
首页 > 系统相关> > 技巧 | 程序员必备Linux常用命令大集合

技巧 | 程序员必备Linux常用命令大集合

作者:互联网

 

小小搜集了Linux的常用的命令的集合。

pwd 命令

使用pwd命令可以立刻得知当前所在的工作目录的绝对路径

[www@cb.vu]~> pwd                                                                                                                                                                                                              
/home/www        
cd 命令

改变当前目录到目录名,若目录名称省去,将会直接变换到使用者的用户的主目录,也就是刚刚登陆的时候的主目录。

                                                                                                                                                                                                                               
[www@cb.vu]~> pwd                                                                                                                                                                                                              
/home/www                                                                                                                                                                                                                      
[www@cb.vu]~> cd ..                                                                                                                                                                                                            
[www@cb.vu]/home> pwd                                                                                                                                                                                                          
/home                                                                                                                                                                                                                          

ls 命令

显示当前目录所包含的文件和子目录。

[www@cb.vu]/home> ls                                                                                                                                                                                                           
www             

ls -l 命令

以完整的样式显示当前目录下的文件和目录

[www@cb.vu]/home> ls -l                                                                                                                                                                                                        
drwxr-xr-x   1 root  wheel    766 Nov 10  2007 www  
mkdir 命令

使用mkdir命令,可以新建子目录

~ $ mkdir ./ming                                                                
~ $ ls                                                                          
ming                                                                            

rmdir 命令

删除空的子目录

~ $ ls                                                                          
ming                                                                            
~ $ rmdir ./ming/                                                               
~ $ ls                                                                          

cp 命令

使用cp命令把一个源文件备份到另外一个目标文件

~ $ touch ./ming                                                                
~ $ touch ./ming1                                                               
~ $ ls                                                                          
ming   ming1                                                                    
~ $ cp ./ming ./ming2                                                           
~ $ ls                                                                          
ming   ming1  ming2                                                             

rm 命令

使用rm命令删除文件

~ $ ls                                                                          
ming   ming1  ming2                                                             
~ $                                                                             
~ $ rm ./ming2                                                                  
~ $ ls                                                                          
ming   ming1                                                                    

find 命令

使用find命令可以查看文件或者目录

在根目录下查询文件名为login的文件,并把查询的结果打印出来。

~ $ find / -name login -print                                                   
find: /proc/tty/driver: Permission denied                                       
find: /proc/1/task/1/fd: Permission denied                                      
find: /proc/1/task/1/fdinfo: Permission denied                                  
find: /proc/1/task/1/ns: Permission denied  
rar 命令 备份

使用tar命令进行备份

~ $ tar -cvf ming.tar ./ming                                                    
./ming                                                                          
~ $ ls                                                                          
ming      ming.tar  ming1                                                       

gzip 压缩

使用gzip命令可以实现对文件的压缩

~ $ gzip ./ming.tar                                                             
~ $ ls                                                                          
ming         ming.tar.gz  ming1                                                 

gunzip 解压缩

使用gunzip命令可以实现对文件的解压缩

~ $ gunzip ./ming.tar.gz                                                        
~ $ ls                                                                          
ming      ming.tar  ming1                                                       

ps 命令

使用ps命令显示进程

~ $ ps -e                                                                       
PID   USER     TIME   COMMAND                                                   
    1 root       0:00 init                                                      
    2 root       0:00 [kthreadd]                                                
    3 root       0:00 [ksoftirqd/0]                                             
    4 root       0:00 [kworker/0:0]                                             
    5 root       0:00 [kworker/0:0H]                                            
    6 root       0:00 [kworker/u2:0]                                            
    7 root       0:00 [kdevtmpfs]                                               
    8 root       0:00 [writeback]                                               
    9 root       0:00 [bioset]                                                  
   10 root       0:00 [kblockd]                                                 
   11 root       0:00 [ata_sff]                                                 
   12 root       0:00 [rpciod]                                                  
   13 root       0:00 [kworker/0:1]                                             
   14 root       0:00 [kswapd0]                                                 
   15 root       0:00 [fsnotify_mark]                                           
   16 root       0:00 [nfsiod]                                                  
   17 root       0:00 [kworker/u2:1]      
kill命令

使用kill命令可以把进程杀死

kill -9 3872
ping 命令

使用ping命令可以实现主机与目标主机的网络连通性

~ $ ping www.baidu.com                                                          
PING www.baidu.com (104.193.88.123): 56 data bytes                              
64 bytes from 104.193.88.123: seq=0 ttl=56 time=279.181 ms                      
64 bytes from 104.193.88.123: seq=1 ttl=56 time=283.378 ms                      
^C                                                                              
--- www.baidu.com ping statistics ---                                           
2 packets transmitted, 2 packets received, 0% packet loss                       
round-trip min/avg/max = 279.181/281.279/283.378 ms                             

ifconfig 命令

使用该命令可以显示其网卡的信息

ifconfig
watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10,y_10,shadow_90,type_ZmFuZ3poZW5naGVpdGk=

小明菜市场

标签:00,命令,Linux,www,ming,程序员,ls,常用命令,root
来源: https://blog.51cto.com/u_14032861/2990215