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.
If you have a new feature suggestion or find a bug, please get in touch via http://commandlinefu.uservoice.com/
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:
Lots of fun to run on nfs clients when the server or network connection is having issues
Disabling an interface's multicast filter is like disabling IGMP snooping on a switch. It is useful for testing and troubleshooting.
Daemontools won't always properly reap it's children. Sometimes when you need to kill the main svscan process, you want to also clean up all of it's children. The way to do that is to send a signal to the entire process group. It is a bit tricky
Sometimes you want to see all of the systcls for a given $thing. I happened to need to easily look at all of the vm sysctls between two boxes and compare them. This is what I came up with.
See the summary.
To get most of you HDD/SSD driver you need to make sure you partition are aligned, if not the speed penalty can be up to 50% slower!
this simple one liner will check to see if each partition start sector is divided by 512
you need to change sda with your driver
if you find the one of your partitions is not aligned use gparted to move the start sector of the partition to be divided of 512
"What it actually shows is going to be dependent on the commands you've previously entered.
When you do this, bash looks for the last command that you entered that contains the substring "ls", in my case that was "lsof ...". If the command that bash finds is what you're looking for, just hit Enter to execute it. You can also edit the command to suit your current needs before executing it (use the left and right arrow keys to move through it).
If you're looking for a different command, hit Ctrl+R again to find a matching command further back in the command history. You can also continue to type a longer substring to refine the search, since searching is incremental.
Note that the substring you enter is searched for throughout the command, not just at the beginning of the command." - http://www.linuxjournal.com/content/using-bash-history-more-efficiently
When I do a major change in my entities, I want to find a way to find all my Entities names and create the commande for me.
So instead of doing ls src/Your/OwnBundle... and then do it manually, this helps a lot.
Creates a single primary partition starting at sector 0 and extending to the end of the disk. Use with care.
this work even if a partition table exist
This command displays the CPU idle + used time using stats from /proc/stat.
If you changed the default policy on any chain other than filter table chain's, this won't be enough.
Shows all configurations to apt and dpkg, rarely changed, you probably still have the default configuration. Go ahead and explore your configuration if you dare, perhaps change your apt-cache directory, Dir::Cache "var/cache/apt/"; or the names of the log files.
Converts a number of bytes provided as input, to a human readable number.
You need to have figlet(for font) and cowsay installed.
Just copy n paste this command and you can see.....
You need to have figlet(for font) and cowsay installed then add it to your .bashrc file.You can see it every time after start a new session.
Assumes that the files are named as such: 01-Filename.mp3
If your files are named differently, change the number of periods in the sed 's/...\(.*\)/\1' bit to match the numbers of characters you need to cut off the front of the file.
Note: This only writes the titles.
Assumes that the files are named in numerical order (ie. 01 Filename.mp3). It will set the track number as tracknumber/totaltracks (ie. 1/14). This will write both ID3v1 and ID3v2 tags.
Note: This only writes the track numbers.
this will open a new tab in firefox for every line in a file
the sleep is removable but i found that if you have a large list of urls 50+, and no sleep, it will try to open all the urls at once and this will cause them all to load a lot slower, also depending on the ram of your system sleep gives you a chance to close the tabs before they overload your ram, removing & >2/dev/null will yield unpredictable results.
Unmounts all CIFS-based network drives. Very nice for shutting down network mounts on a Linux laptop just prior to going to sleep.
Just an alternative with more advanced formating for readability purpose. It now uses colors (too much for me but it's a kind of proof-of-concept), and adjust columns.