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:
eth0 = the name of the interface
00:01:02:03:04:05 = the new mac adresse
the same thing for wireless card $ sudo iwconfig eth1 hw ether 00:01:02:03:04:05
Create a temporary file that acts as swap space. In this example it's a 1GB file at the root of the file system. This additional capacity is added to the existing swap space.
Schedule your Mac to sleep at any future time.
Also wake, poweron, shutdown, wakeorpoweron. Or repeating with
sudo pmset repeat wakeorpoweron MTWRFSU 7:00:00
pmset -g sched
ec commits changes to etckeeper
must have etckeeper installed with bzr to use this
place inside bashrc
can be used from any directory to commit changes
Shred can be used to shred a given partition or an complete disk. This should insure that not data is left on your disk
Shows the UUID of a filesystem or partition that can be used in kernel root options and in fstab.
Run it without the -u option to generate more information. eg:
~/ sudo vol_id /dev/sda2
Installing most OSX apps is just a matter of dropping it in /Applications, either GUI-wise or with cp -r. However, many packages are distributed in "mpkg" format, and those have to be installed with an installer. If you don't want to go to the trouble of firing up VNC to install an mpkg, you can use the "installer" command.
This will install an application from a .mpkg it to /Applications system-wide. To install a program for just one user, replace "-target /" with "-target username".
Purge all configuration files of removed packages
Useful for removes a package and its depends, for example to remove the gnome desktop environment, also configuration files will be removed, you should be carefully and sure that you want to do this.
Basically an improvement on an earlier ethtool command line.
The command is useful when, e.g., booting an existing system with a rescue or installation CD where you need to chroot into the hard-disk and be able to do stuff which accesses kernel info (e.g. when installing Ubuntu desktop with LVM2 you need to mount and chroot the hard disk from a shell window in order to install packages and run initramfs inside chroot).
The command assumes that /mnt/xxx is where the chroot'ed environment's root file system on the hard disk is mounted.
Reconfigures time zone in Ubuntu, which I cannot figure out how to do through the GUI. Worked like a charm to set my time zone to CEST from EDT.
This will view the console and assumes the screen is 80 characters wide.
Use /dev/vcs2 for the next virtual console.. etc.
Ever since the switch to pulseaudio, Ubuntu users including myself have found themselves with no sound intermittently. To fix this, just use this command and restarts firefox or mplayer or whatever.
On Ubuntu, the default editor for visudo is nano. To change the editor to something else (e.g., vi) use this command.
Replace "en1" with your network interface (on OS X, usually en0, en1, eth0, etc..)
the middle command between the ; and ; is the vi commands that insert that line into the last line of the file, the esc with the carets is literally hitting the escape key, you have to have the smbfs package installed to do it, I use it to access my iTunes music on my mac from my linux PC's with amarok so I can play the music anywhere in the house. among other things, it allows you to access the files on that share from your computer anytime you're on that network.
Are there any creative pieces of music that can be created using beep and the shell? I'd love to hear it!
To install a theme use:
sudo firefox -install-global-theme /path/to/theme
You can get the .xpi or .jar file from the versions history on the add-on/theme page.
NOTE: may not work in your system (Debian-based is an example).
This is useful for sending data between 2 computers that you have shell access to. Uses tar compression during transfer. Files are compressed & uncompressed automatically. Note the trailing dash on the listening side that makes netcat listen to stdin for data.
on the listening side:
sudo nc -lp 2022 | sudo tar -xvf -
explanation: open netcat to -l listen on -p port 2022, take the data stream and pipe to tar -x extract, -v verbose, -f using file filename - means "stdin"
on the sending side:
tar -cvzf - ./*| nc -w 3 name_of_listening_host 2022
explanation: compress all files in current dir using tar -c create, -v verbose, -f using file, - filename - here means "stdout" because we're tar -c instead of tar -x, -w3 wait 3 seconds on stream termination and then end the connection to the listening host name_of_listening_host, on port 2022