commandlinefu.com is the place to record those command-line gems that you return to again and again.
Delete that bloated snippets file you've been using and share your personal repository with the world. 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.
You can sign-in using OpenID credentials, or register a traditional username and password.
First-time OpenID users will be automatically assigned a username which can be changed after signing in.
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.
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:
Wow, didn't really expect you to read this far down. The latest iteration of the site is in open beta. It's a gentle open beta-- not in prime-time just yet. It's being hosted over at UpGuard (link) and you are more than welcome to give it a shot. Couple things:
Changes machine and cd to specific directory
Add to .*shrc
If you want to carry on your aliases while using sudo, put this into a file which will be parsed when logging in.
sort is way slow by default. This tells sort to use a buffer equal to half of the available free memory. It also will use multiple process for the sort equal to the number of cpus on your machine (if greater than 1). For me, it is magnitudes faster.
If you put this in your bash_profile or startup file, it will be set correctly when bash is started.
sort -S1 --parallel=2 <(echo) &>/dev/null && alias sortfast='sort -S$(($(sed '\''/MemF/!d;s/[^0-9]*//g'\'' /proc/meminfo)/2048)) $([ `nproc` -gt 1 ]&&echo -n --parallel=`nproc`)'
echo|sort -S10M --parallel=2 &>/dev/null && alias sortfast="command sort -S$(($(sed '/MemT/!d;s/[^0-9]*//g' /proc/meminfo)/1024-200)) --parallel=$(($(command grep -c ^proc /proc/cpuinfo)*2))"
To prevent accidental deleting of files you can disable rm with this alias. Then use the trash command from trash-cli instead.
The command creates an alias called 'path', so it's useful to add it to your .profile or .bash_profile. The path command then prints the full path of any file, directory, or list of files given. Soft links will be resolved to their true location. This is especially useful if you use scp often to copy files across systems. Now rather then using pwd to get a directory, and then doing a separate cut and paste to get a file's name, you can just type 'path file' and get the full path in one operation.
use xdg-open without looking at error messages
(nautilus:3955): Gtk-WARNING **: Theme parsing error: Notebook.css:21:15: Junk at end of value
Alias to play flash videos with mplayer. You can replace mplayer with your favorite video player.
This alias supports Chrome & Firefox's way of handling the flash plugin. It will play all the videos in the cache. Note that certain videos might never make it to the cache, if the publisher ask for them not to: they will just be loaded in RAM.
A variant if you're just interested in playing the audio, for example for a music :
alias flashmusic="mplayer -vo null \$(find /proc/\$(pgrep -f 'libgcfl|libflashplayer')/fd/ -printf '%p %l\n' |grep FlashXX | cut -d\ -f1)"
requires a gmail account, it opens Google tasks in a self contain window, to write your todo list and have it sync online yay =)
Syntax outside of an alias would be printf %b \\033c. This clears the screen and removes scrollback. Works on gnome-terminal and the XFCE's Terminal, and XTerm. It does clear the screen in Konsole and the Mac Terminal, but does not clear scrollback.
Uses printf command to resize terminal.
So far, this is tested to NOT work in Konsole. Works with Mac Terminal, XFCE Terminal, XTerm, gnome-terminal.
Creates an alias that reports your hostname and IP for you computer. Getting the quotes in an alias with awk commands can be a painful. Need uname and ifconfig--both are included in most unix distributions, I believe. Hope it is useful.
I put this line in my ~/.bashrc file (which I source via ~/.bash_profile). Now, when I need to install a package, I typed *install* instead of the longer version.
use python as calculator, press ctrl+d to exit
reminder: when doing factions add atleast one decimal number like so
22.0/7 or 22/7.0
Prints out the list of date(1) format codes, for quick easy reference.
Enhancement for the 'busy' command originally posted by busybee : less chars, no escape issue, and most important it exclude small files ( opening a 5 lines file isn't that persuasive I think ;) )
This makes an alias for a command named 'busy'. The 'busy' command opens a random file in /usr/include to a random line with vim.
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.
another formatting/oneliner for lsof User - Process - Port
This alias is meant to append n (here is n=10) most recently used cd commands to the bottom of history file. This way you can easily change to one of previous visited directories simply by hitting 1-10 times arrow up key.
Hint: You can make more aliases implying the same rule for any set of frequently used long and complex commands like: mkisof, rdesktop, gpg...
Put the function in your .bashrc and use "map [alias]" to create the alias you want. Just be careful to not override an existing alias.
google query_with_spaces "
so, make sure to end your query with a double quote