linux 命令2

who
who am i

ssh scott@192.168.1.105


ps aux | grep pts/8



pwd  // where are you?



Page 205
mkdir -p dir1/dir2/dir3/dir4/dir5
rm -r dir1        //deleted all directory  (include subDirectory)

rmdir -p dir1/dir2/dir3/dir4/dir5    //just need type all subDirectory





 













PATH is important    -----vbird page 205
echo $PATH

add varia

PATH= "$PATH":/root
-------------

create shortCut    link the origin file
touch DeskTop/a.txt
cp -s DeskTop/a.txt .
cp -s DeskTop/a.txt b.txt




which 

whereis
locate    (updatedb)

find 

find ~/ -name dir6.txt     //need type which directory
find /home -name dir6.txt


//redirect   Page 394 
//  >>  >     <<  <      2>>  2>

find /home -name dir6.txt >> ret.txt 2>> errRet.txt  //just redirect 


-------------
mount /umount:
ln [option]  ..target ..DIRECTORY

help


------------
fdisk -help

---------
mkfs -t ext3

--------
 mount ios image
mount -o loop /root/centos6.3_x86_64.iso /mnt/centos_dvd
umount /mnt/centos_dvd



compress / uncompress

bzip2 a.txt
bunzip2 a.txt.bz2



--------------------
touch a.txt
nano a.txt
vim a.txt

gedit a.txt
emac a.txt

--------------------

:sp  /etc/a.txt



--------------
set 
unset

read 
array
declare

alias lm='ls -al'    //bie ming 
unalias lm


-----------------//hackerssa
history    //list the history what you type



//Page 396
/dev/null

//do not display stderr infomation(display stdout only)
find /home -name dir6.txt > ret.txt 2> /dev/null   



==========================
cat > catFile
bala bala.....
bala...
ctrl +D(terminated enter)

=========================
cat > catFile << "eof"
bala bala....
bala ...
eof   (teminated by auto,  when you type "eof")



standard input < <<   output > >>
standard error output 2> 2>>


======================
 ;,   &&,   ||

condition  


 
===========
$?

cmd1 && cmd2   if (cmd1 == ture), so excute cmd2;
		if(cmd1 != True), so do not excute



excute cmd2 
cmd1 || cmd2   if (cmd1 == ture), so do not excute cmd2;
		if(cmd1 != True), so excute cmd2

==================
pipe


cut   		//Page 401
echo $PATH 	//just take a look
echo $PATH | cut -d ':' -f 5   	//display the fiveth info, separate by ':'




grep  //Page 402 display something which need condition

ls -al /etc | less     //display standard output to other 
ls -al /etc | grep dir_1  //display directory which name is "dir_1"

=====================
export 


//display all the infomation about login (it's important)
last 

last | grep 'scott'  //display login infomation as scott (account)
last | grep 'scott'  //display login infomation as root



==================
sort order
sort, wc, uniq

ls | sort
ls | sort -n
ls | sort -r
ls | sort -f
ls | sort -t ':'






原文地址:https://www.cnblogs.com/scotth/p/6897469.html