The pipe to head removes the listing of . as the largest directory.
cn stands for "Cat Null" . The idea is that sometimes you run across something on maybe a webpage - like commandlinefu - that you want to try out on your terminal. You could put a '#' in and then paste it, but what if it is several lines? . This command will echo the pasted characters to the screen and divert them to the bit bucket. . Put this simple alias in your .bashrc, hit cn, paste away, and hit a ctrl+c or a ctrl+d when you are done to get your prompt back. Show Sample Output
Set Permission to user and group Show Sample Output
Courtesy of LifeHacker.com (http://lifehacker.com/5625725/open-the-gnome-applications-menu-with-the-windows-key)
grep 'HOME.*' data.txt | awk '{print $2}' | awk '{FS="/"}{print $NF}' OR awk '/HOME/ {print $2}' data.txt | awk -F'/' '{print $NF}' In this example, we are having a text file that is having several entries like: --- c1 c2 c3 c4 this is some data HOME /dir1/dir2/.../dirN/somefile1.xml HOME /dir1/dir2/somefile2.xml some more data --- for lines starting with HOME, we are extracting the second field that is a 'file path with file name', and from that we need to get the filename only and ignore the slash delimited path. The output would be: somefile1.xml somefile2.xml (In case you give a -ive - pls give the reasons as well and enlighten the souls :-) )
During this operation : # mv Joomla_1.5.10-Stable-Full_Package.zip /var/www/joomla/ I invoke /var/www/joomla/ as last command argument. To change in this directory I can use # cd !$ So I go to hob:/var/www/joomla#
Should do exactly the same - compress every file in the current directory. You can even use it recursively:
gzip -r .
Take advantage of sudo keeping you authenticated for ~15 minutes. The command is a little longer, but it does not require X (it can run on a headless server).
Linux : these script enable you to edit multiple files and remove exact phrase from multiple files
Although rm is protected against it, there are many commands that would wreak havoc on entering the obvious ".*" to address "dot-files". This sweet little expression excludes the dirs "." and ".." that cause the problems. Show Sample Output
grep -sq "" filename && command grep can be used in combination with && to run a command if a file exists.
* ps -ef # list running processes * grep string * pull the process names from 8th field * cut and delimiter '/' * print 4th field * get rid of trailing grep * for loop killall -9 $i which is the process name Show Sample Output
bvi is your vi for binary editing. If your system does not have it, you can get it from http://bvi.sourceforge.net/
Using XSLT. Show Sample Output
It suspends to RAM: you always need your batteries for the RAM but it saves time as there is no need to slowly archive everything on your hard disk. It works fine with me but if anyone has a nicer way, please contribute.
-s Make a signature. -e Encrypt data. -r Encrypt for user id name.
That's useful when you're doing some web scraping http://en.wikipedia.org/wiki/Web_scraping and you're trying to test your possibly fake user-agent. Show Sample Output
commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.
Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.
» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10
Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):
Subscribe to the feed for: