/* find */
find the filename include "snort"$ find / -name '*snort*'
/* cd */
go to last directory
$ cd -
/* sudo */
sudo <last command>
$ sudo !!
/* command conbination */
for large data, which include a lot new lines, space, or repeated data
$ cat out | sort | uniq | less
/* Makefile */
this command will not show up on the terminal if you start with '@'
makefile
build:
@mkdir dir
run many times of test program
$ make; while true do "./test"; done
/* VIM*/
VI go to the end of line$
VI go the beginning of the line
0
go to a specific line when your file is very large
$ vim filename 99999
/* stderr*/
use "2>&1" to have stderr go to the same place that stdout is going to:./myprogram > my_output_and_errors 2>&1
/* typescript*/
/* rescync*/
rescync: this is for back purposehttp://www.comentum.com/rsync.html
example:
rsync -r WorkSpace username@sr1s5.mesa.gmu.edu:/home/username/usernameWorkSpace
if the ssh port is not 22. For example, you backup storage behind a NAT, you forward router 2225 traffic your port 22 on your machine. you could do:
rsync -r -e "ssh -p 2225" ./srcDir username@hostname:/dstDir
/* cmp */
we could use cmp to compare two binary file.
$ cmp -l binaryfile1 binaryfile2
-l print out:
<the number of bytes (decimal) where not same> <content in binaryfile1> <content in binaryfile2>
/* diff */
we could creat patch by using diff. e.g. create kenerl patch
diff -Naur linux-2.6.11.12 linux-2.6.11.12-hw > patch1
/* GHex */
usefull tool of hex editor
/* tail*/
tail -f ./*: it is very useful for log files.
/* grep*/
grep -iHRn *pattern*: ignore case, file name of matching file, recersive search, line number
/* ssh*/
$!sshthis will executed the lastest ssh command, if you cannot remember the IP address
you could also try:
$!cd
if you cannot remember the directory.
/* nohup*/
$nohup commandIt is used when you in ssh terminal session. When you are running a program on the remote host, you don't want the program terminate after you close the terminal. If you use nohup, and it will not terminate the program when you close the terminal.
/* du */
$du -sh direcotry/* df */
/* Ctr+Alt + F1/F2.../F9*/
Press this key, you will see the command. Or text mode.
/* cat id_rsa.pub | pbcopy */
This command will put the content of di_ras.pub to clickboard. When you do pasting, it will paste the content of id_rsa.pub
$bg // let the program run at background
$fg // run foreground
killall while1(processname)
pkill while1
This will create a file named test on current directory. In this file, there are 10 bytes 0x00
if: input file; of: output file; bs: block size; count: the number of blocks
dd is to copy data from input file to output file
http://en.wikipedia.org/wiki//dev/zero
/* fdisk -l */
Show all the disk information. like how many partition in current hard disk. and how many partitions in other disks.
/* bg fg */
Ctr + Z, stoped the program$bg // let the program run at background
$fg // run foreground
/* kill */
kill -9 processIDkillall while1(processname)
pkill while1
/* dd */
dd if=/dev/zero of=test count=2 bs=5This will create a file named test on current directory. In this file, there are 10 bytes 0x00
if: input file; of: output file; bs: block size; count: the number of blocks
dd is to copy data from input file to output file
http://en.wikipedia.org/wiki//dev/zero
/* who */
Check who is logged in the server
No comments:
Post a Comment