wrap it in a function if you like...
lastfile () { ls -ltp | sed '1 d' | head -n1 }
Show Sample Output
Will print the host associated with the current stdin. This is useful to set the DOIT_SERVER for the doit remote execution agent ( http://www.chiark.greenend.org.uk/~sgtatham/doit/ ) export DOIT_HOST=$(who -m | sed 's/.*(\(.*\)).*/\1/') Note that SSH_CLIENT variable can be lost if you use su or sudo (if set to reset vars) Show Sample Output
This is to get the latest version of phpMyAdmin to support scripts to download the latest version of the software if they want to automatically update. Show Sample Output
This is a more concise answer to http://blog.commandlinekungfu.com/2011/09/episode-158-old-switcheroo.html in my opinion.
The first grep rejects capitalised words since the dict has proper nouns in it that you mightn't want to use. The second grep rejects words with ending in apostrophe s, and the third forces the words to be at least 15 characters long. Show Sample Output
This command lists all the directories in SEARCHPATH by size, displaying their size in a human readable format. Show Sample Output
Calc the rough time from Twitter. Now with leading Zeroes. Show Sample Output
Fetch comical VC commit messages from whatthecommit.com Show Sample Output
Convert text from lowercase to uppercase Show Sample Output
If you don't send an interface, it shows private IP address of all interfaces
I know you can use pidof but with this you can know the specific PID with his command arguments (useful if you're running various proccess with same application)
Instead of tedious manual mv commands and tabbing, this routine creates a file listing all the filenames in the PWD twice, edit the second instance on each line to the new name, then save the file, the routine does the rest. Feel free to replace nano with your holy war editor of choice. You will get a lot of "mv: 'x' and 'x' are the same file" warnings, these could be cleaned up but the routine works.
Of course, this command must be executed at a GRID User Interface lhcb - name of your VO, substitute it with the one you are interested it. Show Sample Output
Great idea camocrazed. Another twist would be to display a different man page based on the day of the year. The following will continuously cycle through all man pages:
man $(ls /bin | sed -n $(($(date +%j) % $(ls /bin | wc -l)))p)
Broaden your knowledge of the utilities available to you in no particular order whatsoever! Then use that knowledge to create more nifty one-liners that you can post here. =p Takes a random number modulo the number of files in $dir, prints the filename corresponding to that number, and passes it as an argument to man.
I had a file named " " (one space) and needed a way to see what the real filename was so I could remove it. sed to the rescue. Show Sample Output
This heavy one liner gets all the files in the "/music/dir/" directory and filters for non 44.1 mp3 files. After doing this it passes the names to sox in-order to re-sample those files. The original files are left just in case.
#Sample Usage: # git commit -m"Jira #404 - `whatthecommit`" # Show Sample Output
Finds the line number matching the regex, then passes that to BC for some math, passes that to head, and uses tail to trim off the unwanted section at the top. The whole thing is spit out to a script that can then be shared or run. Comes in handy for reading select sections from error logs.
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: