linux common command
powered by Movan python.
-
path
cd cd ~ # home contents cd ../ # back cd ../../ ls ls -l # list long ls -lh # easy to explain ls --help # see more information
-
copy
touch file1.txt # create file1 touch file2 file3 cp old_file new_file cp file ../Document cp file1 file2 # 会替代重名文件 cp -i file1 file2 # 提示 cp file1 folder1/ or cp file1 ./folder1 cp -R folder1/ folder2/ # copy directory cp file* folder1/
-
mv
mv file1 folder1/ mv file1 file2 # rename file1 to file2 mv folder1/ folder2 mv --help
-
create
mkdir # create a file directory mkdir folder1 rm(remove) touch folder1/file1 rmdir folder # error,can't delete a directory with file rm file ; rmdir folder1 or rm -r folder1 touch f1 f2 f3 f4 rm -i f1 f2 f3 f4 # type y or n rm -I f1 f2 f3 f4 # choose rm -I f1 f2 f3 # del them(number<=3) derectly
-
catfile
cat *.py # display content cat t.py > t1.py cat t.py t1.py > t2.py cat t2.py lots of applications cat t3 >> t2.py # add t3 to the end of t2
-
chmod
ls -l file type: d:derectory _:file chmod [who] [+/-/=] [file_name] chmod u+x c.py chmod ug-rw c.py python3 c.py 调用python3运行 ./c.py 执行 如果执行python程序,要增加#! /usr/bin python3
-
ssh