10条有用的LINUX命令

On 2011年01月18日, in soft, by netoearth

Since our list of unknown but useful Linux terminal commands has become quite popular, I would like to give you another round of handy Linux one-liners. If used appropriately, these commands will help you do the job quickly and efficiently.Without further delay, here is an additional list of unknown but useful Linux terminal commands (in no particular order):

1. A quick way to rename a file:
mv name_of_file.{old,new}
2. Monitoring progress of a particular command:
pv access.log | gzip > access.log.gz
3. Deleting every file in a folder that don’t match a specific file extension
rm !(*.foo|*.bar|*.baz)
4. Removing duplicate entries in a file without sorting:
awk ‘!x[$0]++’
5. Ripping audio from a video file:
mplayer -ao pcm -vo null -vc dummy -dumpaudio -dumpfile
6. Displaying the Linux distribution name and version:
cat /etc/issue
7. Creating a script of the last executed command:
echo “!!” > foo.sh
8. Extracting tarball from the Internet without saving it locally:
wget -qO – “http://www.tarball.com/tarball.gz” | tar zxvf –
9. Removing all files except the one specified:
rm -f !(never_delete.txt)
10. Editing a file on a remote host using vim:
vim scp://username@host//path/to/name_of_file

Tagged with:  

Comments are closed.