实用shell命令

实用shell

sudo !!
python -m SimpleHTTPServer
^foo^bar
ctrl-x e
<space>cmd
alt+. or Esc+.
reset
mount | column -t
man ascii
curl ifconfig.me
mount -t tmpfs tmpfs /mnt -o size=1024m
sshfs name@server:/path/to/folder /path/to/mount/point
du -h --max-depth=1
echo "ls -lah >/foo/bar/ls.txt" |at 07:00
pushd /path/to/dir ; command_to_execute; popd
cd /path/to/dir && command_or_script; cd -;
wget --random-wait -r -p -e robots=off -U mozilla http://www.example.com    download an entire website
mount -t tmpfs tmpfs /mnt -o size=1024m
lsof -P -i -n           show apps that use internet connection now
nc -v -l 80 < file.ext   share your file at http 80
lsof -i
!*   reuse all parameters of the previous cmd
\[command]    ignore any alias
while sleep 1;do tput sc;tput cup 0 $(($(tput cols)-29));date;tput rc;done &          shell前添加时间 
getconf LONG_BIT   查看本机位
ps aux | sort -nk +4 | tail   sort by mem
history | awk '{a[$2]++}END{for(i in a){print a[i] " " i}}' | sort -rn | head   常用的10个命名
disown -a && exit     close shell keeping all subprocess running
net rpc shutdown -I ipAddressOfWindowsPC -U username%password
rm !(*.foo|*.bar|*.baz)   rm all files don't match
ifconfig | convert label:@- ip.png   保存输出为图像
vim -x <FILENAME> 加密码
wget -qO - "http://www.tarball.com/tarball.gz" | tar zxvf -    Extract tarball from internet without local saving
man hier
mplayer -ao pcm -vo null -vc dummy -dumpaudio -dumpfile <output-file> <input-file>  从视频中提取音频
sed -n '10,20p' <filename>  print
ssh-copy-id username@hostname
watch -t -n1 "date +%T|figlet"   显示一个时钟
ffmpeg -f x11grab -r 25 -s 800x600 -i :0.0 /tmp/outputFile.mpg  录相
vim scp://username@host//path/to/somefile 远程编辑
ss -p 显示当前连接
man -t manpage | ps2pdf - filename.pdf 把manpage变成pdf
rm -f !(survivior.txt) 删除所有但一个例外
readom dev=/dev/scd0 f=/path/to/image.iso 将dv制作成iso
tar -tf <file.tar.gz> | xargs rm -r  
dpkg -S /usr/bin/ls  查找命令属于哪个包
ssh -MNf <user>@<host> 建立一个永久的链接
du -s * | sort -n | tail 当前目录下十个最大文件
mount /path/to/file.iso /mnt/cdrom -oloop mount一个iso文件
timeout 5s COMMAND 5s后kill此命令
curl ifconfig.me  外网Ip
find . -type d -empty -delete 递归删除所有空dirs
cp file.txt{,.bak} 快速备份一个
wget -r -l1 --no-parent -nH -nd -P/tmp -A".gif,.jpg" http://example.com/images 下载一个网页上所有图片
until !!; do :; done 执行上一个命令直到成功退出
lsof -i tcp:80
find ./ -type f -exec chmod 644 {} \; 修改权限
mkdir -p work/{d1,d2}/{src,bin,bak} 递归建立文件夹
leave +15   remind yourself to leave in 15m
showkey -a 显示ascii
kill -9 $$ 	exit without in history
sudo find / -mmin 60 -type f  60m内修改过的文件
:TOhtml 在vim中输出为html
pdftotext [file] - | grep 'YourPattern' 在pdf中查找 
grep . filename > newfilename 删除空格
lshw -html > hardware.html 输出为html
nl
python -m http.server
find / -type f -size +500M
grep -lir "some text" *


posted @ 2014-06-25 11:08  海滨银枪小霸王  阅读(182)  评论(0编辑  收藏  举报