Linux Command
来源:互联网 发布:个人大数据征信查询 编辑:程序博客网 时间:2024/04/29 15:46
1. The format of Command: command [option] [file]
The type of file ( - file , d directory , l shortcut ) (right: r w [x execute])
(3 groups: u user, g belong, o other )
2. File Command
New Directory: mkdir -p [filename] // -p can make file under a file which does not exist.
Change Directory: cd ~ // return the home directory.
cd - // return the previous directory
cd .. // return the parent directory
cd . // return the current directory
print working directory: pwd
remove directory: rmdir // but only the empty file
rm -rf [file or directory] // -rf means the system will delete it without asking (-f false : force to delete)
Copy directory: cp [-r -p -d -a] (-p -d: will contain the file's property) (-a means all - -pdr)
Cut directory: mv (can be used to change the name of files)
Link directory: ln [-s] file link_file. // -s refers to soft.(soft link) like the shortcut in windows (if we delete the original file, the soft link is useless)
// without -s means hard link. ( these two files can be seen as the same file) (must in the same partition)
3. Search File Command
locate [file_content], // find the file in /var/lib/mlocate with file name, mlocate is a database which is not updated timely. we can use updatedb command to update it.
whereis [-b -m] [command] : search the command // -m to find the help file
which [command] // can also find the command's alias
find [search_scope] [search_condition] // search_condition could be [-name file_name] (the name should be the same with your file) (wildcard character : * / ? / [] )
// -iname ignore the case
// -mtime +10 : find the files that have been modified 10 days ago(10 without + mean that one day)
// -size +25k : fine the files that are larger than 25k
// -a : AND function. match all conditions. -o : OR function. match one of the condition
command1 -exec ls -lh {} \; \\ accept the result from the first command
grep [string] [file] // find the string in the file
4. Help Command
man [command] // describe how to use this [command] (shortage of manual)
man -f == whatis // describe the command's function
apropos [string]// describe all the command containing "string" in the manual file. equivalent to "man -k "
[command] --help // -- help is also very useful
help [command] // this can only get the build-in command's help file. (in shell)
info [command] // But very detail. It's somewhat not practical
5. Compress and Uncompress Command
format : .zip , .gz , .bz2 , .tar.gz , .tar.bz2
%% this zip format is the same to zip in Windows
zip compressed_Name originFile // (compressed_Name does not need to write the suffix name (.zip) , but suffix name is recommended)
zip -r compressed_name originDirectory // compress the directory.
unzip // Uncompress Command
%% .gz is the exclusive format in Linux
gzip originFile
gzip -r Directory // compress all the file in the Directory, not the Directory
gunzip // Uncompress
%% .bz2
bzip2 originFile
bzip2 -k originFile // can reserve the original file
// Can not compress Directory.
%% .tar.gz
tar -cvf [filename] [OriginFile] -c: compress -v: progress -f: filename ;ex: tar -cvf test.tar test
tar -xvf // uncompress the file
tar -zcvf [filename.tar.gz] [originFile] // compress directly into .tar.gz
tar -zxvf [filename.tar.gz] // uncompress the file
tar -jzcf ... // into .tar.bz2
tar -jxvf ... -C /temp (indicate the location) // uncompress the .tar.bz2
0 0
- linux command
- linux command
- Linux Command
- Linux Command
- linux command
- linux command
- linux command
- LINUX COMMAND
- linux command
- Linux Command
- Linux command
- Linux command
- linux command
- Linux command
- LINUX COMMAND
- Linux [Command]
- linux command
- linux command
- WebKit之Canvas源码分析2
- RSS初体验
- 验证算法——二叉排序树相关算法
- js 对表格的动态操作(动态添加行,删除该行,在指定位置添加控件)
- PyQt5系列教程(二)利用QtDesigner设计UI界面
- Linux Command
- Cobertura单元测试覆盖率实例
- WIFI基本知识整理
- android studio环境问题
- Shell遍历所有文件
- Android Studio 使用过程遇到的坑(记录ing)
- 验证算法——平衡二叉树
- mysql事务处理用法与实例详解
- 剑指offer系列之四十一:和为S的两个数字且乘积最小