For example, if you are the type who type ls very often, then
PROMPT_COMMAND=ls
will ls after every command you issue.
It gzip each file in a directory separately
Another way of doing it that's a bit clearer. I'm a fan of readable code.
Works also with SML/NJ and other interpreters or tools with interactive environments.
Place the regular expression you want to validate between the forward slashes in the eval block. Show Sample Output
Place this in your .bash_profile and you can use it two different ways. If you issue 'h' on its own, then it acts like the history command. If you issue:
h cd
Then it will display all the history with the word 'cd'
on multihomed hosts, connected to several networks, could be usefull to know the source address (local ip address) used to reach the target host, this command does not require root priviledges. The command use a TCP socket, if there is any error the command return an empty string, elsewhere return a valid ip address. Show Sample Output
Joker wants an email if the Brand X server is down. Set a cron job for every 5 mins with this line and he gets an email when/if a ping takes longer than 3 seconds. Show Sample Output
Perfect time for the rarely used sub shell.
Usefull e.g. in krusader open terminal function
In this simple example the command will add a comma to the end of every line except the last. I found this really useful when programatically constructing sql scripts. See sample output for example. Show Sample Output
Get full url via untr.im Show Sample Output
plays with bash arrays. instead of storing the list of files in a temp file, this stores the list in ram, retrieves the last element in the array (the last html file), then removes it.
Converts a .vdi file to a .vmdk file for use in a vmware virtual machine. The benefit: using this method actually works. There are others out there that claim to give you a working .vmdk by simply using the qemu-img command alone. Doing that only results in pain for you because the .vmdk file will be created with no errors, but it won't boot either. Be advised that these conversions are very disk-intensive by nature; you are probably dealing with disk images several gigabytes in size. Once finished, the process of using the new .vmdk file is left as an exercise to the reader. Show Sample Output
Calculates the size on disk for each package installed on the filesystem (or removed but not purged). This is missing the
| sort -rn
which would put the biggest packges on top. That was purposely left out as the command is slightly on the slow side
Also you may need to run this as root as some files can only be checked by du if you can read them ;)
Show Sample Output
sed can be used deleting the last line and with -i option, there's no need to for temp files, the change is made on the actual file
Some malicious program appends a iframe or script tag to you web pages on some server, use this command to clean them in batch.
This would allow reference of $(VAR) (if defined) with the value 'foobar' within the Makefile.
add the command either in /etc/profile or ~/.bash_profile so that this is available to your shell. 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: