标签:art erb update ast number start str shuffle yam
watch "ls -larth"
sudo fuser -k 8000/tcp
ulimit -Sv 1000 # 1000 KBs = 1 MB
ulimit -Sv unlimited # Remove limit
rename ‘s/\.bak$/.txt/‘ *.bak
readlink -f file.txt
tar tf file.tgz
tar xf file.tgz filename
ls -lS
mtr google.com
find . -size 20c # By file size (20 bytes)
find . -name "*.gz" -delete # Delete files
find . -exec echo {} \; # One file by line
./file1
./file2
./file3
find . -exec echo {} \+ # All in the same line
./file1 ./file2 ./file3
yes
yes hello
w
ls | nl
\t
这样的字符)grep -P "\t"
tac file
检测权限错误是很有用的,例如在配置web服务器时。
namei -l /path/to/file.txt
while inotifywait -e close_write document.tex
do
make
done
cat file.txt | xclip -selection clipboard
detex file.tex | diction -bs
你可能需要安装以下内容:sudo apt-get install diction texlive-extra-utils
。
/usr/bin/time -v ls
cat file.txt | sort -R
cat file.txt | sort -R | head # Pick a random sambple
# Even better (suggested by xearl in Hacker news):
shuf file.txt
如果程序不需要任何交互:
nohup ./script.sh &
如果你需要手动输入一些内容,然后离开:
./script.sh
<Type any input you want>
<Ctrl-Z> # send process to sleep
jobs -l # find out the job id
disown -h jobid # disown job
bg # continue running in the background
当然,也可以使用screen
或tmux
来完成此目的。
timeout 10s ./script.sh
# Restart every 30 minutes
while true; do timeout 30m ./script.sh; done
comm file1 file2
打印这三列:
file1
独有。file2
独有。file1
和行file2
中都有。使用选项-1
、-2
、-3
,可以删除这些列。
split -l LINES -d file.txt output_prefix
如果一个程序消耗了太多的内存,交换分区就会被剩余的内存填满,当你回到正常的时候,一切都是缓慢的。只需重新启动交换分区来修复它:
sudo swapoff -a
sudo swapon -a
sudo fsck.ext4 -f -y /dev/sda1
sudo fsck.ext4 -v /dev/sda1
sudo mke2fs -n /dev/sda1
sudo e2fsck -n <first block number of previous list> /dev/sda1
fallocate -l 1G test.img
与join
,shuffle
,select
等命令相比,pdftk
是个更好用的命令:
pdftk *.pdf cat output all.pdf # Join PDFs together
pdftk A=in.pdf cat A5 output out.pdf # Extract page from PDF
还可以使用cpdf
操作内容:
cpdf -draft in.pdf -o out.pdf # Remove images
cpdf -blacktext in.pdf -o out.pdf # Convert all text to black color
# Write random data, encode it in base64 and monitor how fast it
# is being sent to /dev/null
cat /dev/urandom | base64 | pv -lbri2 > /dev/null
# pv options:
# -l, lines
# -b, total counter
# -r, show rate
# -i2, refresh every 2 seconds
apt-file update
apt-file search dir/file.h
标签:art erb update ast number start str shuffle yam
原文地址:http://www.cnblogs.com/feiyu-cn/p/7642334.html