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:
It's certainly not nicely formatted SQL, but you can see the SQL in there...
This command is a great way to check to see if acpi is doing damage to your disks by agressivly parking the read arm and wearing down it's life. As you can see, mine has lost half its life. I'm sure this could be shortened though somehow. It will use smartctl to dump the stats and then grep out just the temperature and load cycles for the disk (a load cycle is when a the read arm comes out of park and wears on the drive).
This command is meant to be used to make a lightweight backup, for when you want to know which files might be missing or changed, but you don't care about their contents (because you have some way to recover them).
Explanation of parts:
"ls -RFal /" lists all files in and below the root directory, along with their permissions and some other metadata.
I think sudo is necessary to allow ls to read the metadata of certain files.
"| gzip" compresses the result, from 177 MB to 16 MB in my case.
"> all_files_list.txt.gz" saves the result to a file in the current directory called all_files_list.txt.gz. This name can be changed, of course.
if you still get a permissions error using sudo, then nano the file:
sudo nano -w /sys/block/sdb/queue/rotational
and change 1 to 0
says that this will "help the block layer to optimize a few decisions"
mounts a samba share on a remote machine using a credentials file that can be in a file tht is not accessable by other users the file will look like:
best option i belive
Mount a Windows share. Usually the IP is needed for the $ip_or_host option. Getting hostnames working on a local network never seems to work.
The empty file /forcefsck causes the file system check fsck to be run next time you boot up, after which it will be removed.
This works too:
Refresh the cache of font directory , usefull after you download font (.ttf or other) from various website and you don't want to reboot or relogin . Close your word processor before using the command , after the refresh reopen your word processor , new fonts is avaible !
convert to debian package file (deb) a redhat package file (rpm) , then you can install it by using dpkg , require alien package ( sudo apt-get install alien first )
This command will disable the beep sound from the PC speaker.
The execution of this command will install a LAMP server (Linux, Apache, MySQL and PHP) in a Debian based distribution. For example, in Ubuntu.
Install a deb package you have downloaded (synaptic has to be closed).
(dpkg-dev needs to be installed)
After that you may have to run following:
sudo apt-get install -f
(that should fix any dependency problems)
I am using ubuntu linux
This will change the ownership of /../../somedirectory as well as all its subdirectories so they will be be owned by user2 - typically used when a directory is owned by root:root
This command dumps all SVN repositories inside of folder "repMainPath" (not recursively) to the folder "dumpPath", where one dump file will be created for each SVN repository.
According to tune2fs manual, reserved blocks are designed to keep your system from failing when you run out of space. Its reserves space for privileged processes such as daemons (like syslogd, for ex.) and other root level processes; also the reserved space can prevent the filesystem from fragmenting as it fills up. By default this is 5% regardless of the size of the partition.