Add -n to last command to restrict to last num logins, otherwise it will pull all available history. Show Sample Output
quick in directory backup of all files in this directory. Adds the .bak extension to all copies.
This command will delete all branches in your git repository other than next and master. I use this to cleanup my git repos after making multiple branches and merging them back into next. It's much faster than individually deleting each expired branch using:
git branch -D <branch_name>
show physical disk using, except tmpfs, gvfs, and so on.
Batch Convert MP3 Bitrate to xxxkbps, all the new files will be placed in a folder called "save". Please replace xxx with the desired bitrate. WARNING!!! This will erase any tag information; this is where Picard or EasyTAG will come in handy. Show Sample Output
finds all forms instanciated into a symfony project, pruning svn files.
I found Flash eating one of my CPUs after resume, the command above will help with that. For optional kicks you can put it into a script in /etc/pm/sleep.d/ (aspect in #swhack wrote this for me)
This command works at least in 9.04+
Deletes capistrano-style release directories (except that there are dashes between the YYYY-MM-DD) Show Sample Output
After installing Termbeamer (see termbeamer.com) you can use it to share a terminal session with one or more others even from behind a firewall or NAT.
Undo accidental file add to mercurial. This command undo file adds to all recent adds
Handles the color codes intended for 256-color terminals (such as xterm-(256)color and urxvt-unicode-256color), in addition to the standard 16-color ANSI forms. Overkill for strict ANSI output, see other options for something simpler.
Find all files larger than 500M in home directory and print them ordered by size with full info about each file. Show Sample Output
Output contains also garbage (text parts from netstat's output) but it's good enough for quick check who's overloading your server.
Needs to be run in a battery sysfs dir, eg. /sys/class/power_supply/BAT0 on my system. Displays the battery's current charge and the rate per-second at which energy is {dis,}charging. All values are displayed as percentages of "full" charge. The first column is the current charge. The second is the rate of change averaged over the entire lifetime of the command (or since the AC cable was {un,}plugged), and the third column is the rate of change averaged over the last minute (controlled by the C=60 variable passed to awk). The sample output captures a scenario where I ran 'yes' in another terminal to max out a CPU. My battery was at 76% charge and you can see the energy drain starts to rise above 0.01% per-second as the cpu starts working and the fan kicks in etc. While idle it was more like 0.005% per-second. I tried to use this to estimate the remaining battery life/time until fully charged, but found it to be pretty useless... As my battery gets more charged it starts to charge slower, which meant the estimate was always wrong. Not sure if that's common for batteries or not. Show Sample Output
U have to make key exchange in order to avoid continuous password prompt. Show Sample Output
lists the files found by find, waits for user input then uses xdg-open to open the selected file with the appropriate program.
usage: findopen path expression [command]
With the third optional input you can specify a command to use other than xdg-open, for example you could echo the filename to stdout then pipe it to another command.
To get it to work for files with spaces it gets a bit messier...
findopen() { files=( $(find "$1" -iname "$2" | tr ' ' '@') ); select file in "${files[@]//@/ }"; do ${3:-xdg-open} "$file"; break; done }
You can replace the @ with any character that probably wont be in a file name.
Monitoring TCP connections number showing each state. It uses ss instead of netstat because it's much faster with high trafic. You can fgrep specific ports by piping right before awk: watch "ss -nat | fgrep :80 | awk '"'{print $1}'"' | sort | uniq -c" Show Sample Output
Same thing just a different way to get there. You will need lynx
% lsof -v lsof version information: revision: 4.78
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: