前後の学友、必ずできるLinuxはよく基礎の命令を使います

7635 ワード

フロントエンドでもバックエンドでも、よく使われるlinuxコマンドは把握しなければなりません.リリース、ログの表示などに使用されます.以下は私が簡単にいくつかの簡単でよく使う命令をまとめたので、皆さんの補充を歓迎します.皆さんのお役に立てばと思います
本文は公衆番号プログラマーが共に成長した公衆番号内で[ギフトバッグ]に返信すれば良質な資源を受け取ることができ、Java、Python、Linux、データベース、ビッグデータ、アーキテクチャ、テスト、フロントエンド、ui及び各方向の電子書籍を含むが、これらに限定されない.
基礎編
1、ディレクトリに入る
cd    

2、現在のパスを表示する
pwd

3、パスの下のファイルを表示する
ls
ls -a   。  . 

4、作成テキストの表示
touch abc.txt   abc.txt           

5、フォルダの作成
mkdir                                        
mkdir -p name1/name2               name1/name2
   mkdir: xxx: Permission denied
admin   sudo -i   

6、名前変更操作
mv test test1                         test        test1
mv test1 /home/wechat/               test1   /home/wechat 

7、削除操作
rm file                          file  (          )
rm -r /file                     file
rm -rf ./*                     

8、コピー
cp file /home                    file   home   
cp -r test /home/wechat         test    /home/wechat
cp -r test /home/wechat/test2   test    /home/wechat test2

9、圧縮、解凍
  tar
tar xvf test.tar
tar
tar cvf test1.tar name            name test1.tar

tar.gz
tar zxvf test.tar.gz

tar zxvf test.tar.gz name

検索&&ログ
1、cat、more、lessコマンド
cat test.log                  test.log      
cat -n test.log              test.log

more、less cat , more 。  q
, ( )


2、findコマンド
.      
find . -name '*.txt'          txt
find . -mtime -2             
find . -atime -3             
find . -mmin +30             
find . -amin +40             
find . -size +1M              1M
find .  -size -1M            1M
find .  -size   +512k       512k
find . -empty              

3、whereisコマンド
whereis name/    name     

4、grepコマンド
ps -ef|grep nginx                 nginx   
ps -ef|grep nginx -c             nginx
cat test.log | grep ^a           test.log  o
cat test.log | grep $k           test.log K
cat test.log | grep 'bd4f63cc918611e8a14f7c04d0d7fdcc' --color      test.log bd4f63cc918611e8a14f7c04d0d7fdcc
 grep 'bd4f63cc918611e8a14f7c04d0d7fdcc' test.log --color

grep -n 'abc' test.log          
grep 'abc' test1.log test2.log       abc

5、tailコマンド
tail -f  xxx.log     xxx.log       10 
tail -f 100 xx.log /tail -100f xx.log   100

6、vimコマンド
vim
vim file 
vim file1 file2 ... 
/vim   ESC
vim
i:
dd: 
D:
2dd:  2
G:
w! 
wq 
q!   
/abc   abc
set nu 
 k( )、j( )、h( )、l( )
yy 
p
o:   

その他の一般的な操作
1、ユーザー情報の表示
w
who

2、ファイル権限の変更
chmod 777 file1                file            
chmod 666 file1          file

3、システムレベル
top             
dh -h 
du -sh /usr  usr

netstat –a   tcp, udp   unix 

kill   
kill -9   
rz lz