Bash 简介

1.Bash is a commonly used shell in Linux(Ubuntu)
bash, tcsh, csh

2.ls,cd,pwd,cp, rm,mkdir,top

3.touch <file>: generate a new emptyfile, or change the timestamp of an existing file

4.which: to see which command you are using

5.man: to see the help of commands

6.grep‘\<Food’ test.txt
find the line begin with Food in test.txtfile

7.find <path> –name test.cpp
find the file with name test.cpp in<path> and its subdirectory
find <path> -name .svn–print0 | xargs -0 rm –rf   #find the files/dirsnamed with .svn anddelete them all
8.chmod:change the read/write/execute permission of files and directories
r/w/x == 4/2/1 
‘chmod 700 papers’  results to drwx------
chmod u+rx <file>; chmod g+rwx<file>

9.umask0002: configure the permission of your newly created files
Directory: 0002 == 0777-0002 = 0775
File: 0002 == 0666-0002 = 0664
10.unix2dos/dos2unix: change the file formatfrom unixformat to dos format; or dos format to unix format

11.<command> 2>&1 | tee<logfile>  
redirect the standard error to standardoutput, and write them all into ‘logfile’
[root@home root]# id das 2>&1 |teelogfile
id: das: No such user
[root@home root]# cat logfile
id: das: No such user

12.<command> 2>&1 >/dev/null| tee logfile
Redirect the standard output into/dev/null,  and then standard error intostandard output. At last, write into logfile.
[root@home root]# make >/dev/null2>&1
[root@home root]# make 2>&1 >/dev/null
make: *** No targets specified and no makefile found.  Stop.

13.nm: see the symbol table in the library
14.ldd:see the library dependency

你可能感兴趣的:(Bash 简介)