学习Linux:http://www.ee.surrey.ac.uk/Teaching/Unix/unix2.html
输入 % man +操作指令 即可获得该指令的说明手册
eg:
man find
Command | Meaning |
---|---|
ls | list files and directories |
ls -a | list all files and directories |
mkdir | make a directory |
cd directory | change to named directory |
cd | change to home-directory |
cd ~ | change to home-directory |
cd .. | change to parent directory |
pwd | display the path of the current directory |
Command | Meaning |
cp file1 file2 | copy file1 and call it file2 |
mv file1 file2 | move or rename file1 to file2 |
rm file | remove a file |
rmdir directory | remove a directory |
cat file | display a file |
less file | display a file a page at a time q to quit |
head file | display the first few lines of a file |
tail file | display the last few lines of a file |
grep 'keyword' file | search a file for keywords |
wc file | count number of lines/words/characters in file |
Command | Meaning |
command > file | redirect standard output to a file |
command >> file | append standard output to a file |
command < file | redirect standard input from a file |
command1 | command2 | pipe the output of command1 to the input of command2 |
cat file1 file2 > file0 | concatenate file1 and file2 to file0 |
sort | sort data |
who | list users currently logged in |
Command | Meaning |
* | match any number of characters |
? | match one character |
man command | read the online manual page for a command |
whatis command | brief description of a command |
apropos keyword | mmatch commands with keyword in their man pages |
Command | chmod |
Symbol | Meaning |
u | user |
g | group |
o | other |
a | all |
r | read |
w | write (and delete) |
x | execute (and access directory) |
+ | add permission |
- | take away permission |
% chmod go-rwx biglist | remove read write and execute permissions on the file biglist for the group and others, type |
% chmod a+rw biglist | To give read and write permissions on the file biglist to all |
Command | Meaning |
ls -lag | list access rights for all files |
chmod [options] file | change access rights for named file |
command & | run command in background |
^C | kill the job running in the foreground |
^Z | suspend the job running in the foreground |
bg | background the suspended job |
jobs | list current jobs |
fg %1 | foreground job number 1 |
kill %1 | kill job number 1 |
ps | list current processes |
kill 26152 | kill process number 26152 |
Command | Meaning |
% df . | The df command reports on the space left on the file system. |
% du -s * | The du command outputs the number of kilobyes used by each subdirectory. Useful if you have gone over quota and you want to find out which directory has the most files. The -s flag will display only a summary (total size) and the * means all files and directories. |
% gzip science.txt | to compress science.txt |
% gunzip science.txt.gz | To expand the file, use the gunzip command. |
% tar -xvf units-1.74.tar | extract the contents of the tar file |
%zcat science.txt.gz | zcat will read gzipped files without needing to uncompress them first. |
% zcat science.txt.gz | less | If the text scrolls too fast for you, pipe the output though less . |
% file * | file classifies the named files according to the type of data they contain, for example ascii (text), pictures, compressed data, etc.. |
% diff file1 file2 | This command compares the contents of two files and displays the differences. |
% find . -name "*.txt" -print | To search for all fies with the extention .txt, starting at the current directory (.) and working through all sub-directories, then printing the name of the file to the screen |
% find . -size +1M -ls | To find files over 1Mb in size, and display the result as a long listing, |
% history | The C shell keeps an ordered list of all the commands that you have entered. Each command is given a number according to the order it was entered.(show command history list) |
% !! % !-3 % !5 % !grep % set history=100 | (recall last command) (recall third most recent command) (recall 5th command in list) (recall last command starting with grep) You can increase the size of the history buffer by typing |