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:
This has been my "sysupgrade" alias since ca. 2006, first used on Debian Sid, then Sabayon, and it still does its duty on Mint nowadays without breaking stuff.
This command will disable a guest user logon, this user don't have password to login in the system.
Bash process substitution which curls the website 'hashbang.sh' and executes the shell script embedded in the page.
This is obviously not the most secure way to run something like this, and we will scold you if you try.
The smarter way would be:
Download locally over SSL
> curl https://hashbang.sh >> hashbang.sh
Verify integrty with GPG (If available)
> gpg --recv-keys 0xD2C4C74D8FAA96F5
> gpg --verify hashbang.sh
Inspect source code
> less hashbang.sh
> chmod +x hashbang.sh
Linux offers an interesting option to restrict the use of dmesg. It is available via /proc/sys/kernel/dmesg_restrict.
You can check the status with:
Alternatively you can use sysctl:
sudo sysctl -w kernel.dmesg_restrict=1
To make your change persistent across reboot, edit a fille in /etc/sysctl.d/.
The command creates new session "test", executes 'date' and then start your default shell (to keep the detached session alive). Change 'date' to fit your needs.
screen -r test
will attach the created session.
This lists the number of ogg/mp3/wav/flac files in each subdirectory of the current directory. The output can be sorted by piping it into "sort -n".
A very simple command to toggle Chrome?s default style sheet. It uses the test command to see if the "Custom.css.off" file exists, if so, it will become "Custom.css", and if not, "Custom.css" is moved to "Custom.css.off" Thus, swapping.
This is accomplished with "&&" and "||"
url can be like any one of followings:
If url mismatching, whole url will be returned.
For each directory from the current one, list the counts of files in each of these directories. Change the -maxdepth to drill down further through directories.
Uses find, plutil and xpath.
Note: Some applications don't have proper information. system_profiler might be better to use.
It's a bit slow query.
Due to command length limit, I removed -name "*.app" and CFBundleName.
Avoids the nested 'find' commands but doesn't seem to run any faster than syssyphus's solution.
This version combines the best of the other suggestions and adds these features:
1. It scans a /16 subnet
2. It is very fast by running the ping commands in the background, running them in parallel.
3. Does not use the "-W" option as that's not available in older ping versions (I needed this for OS X 10.5)
Handles spaces in file names and directories. Optionally change directories as well by pipe to tr from dirname.
run it inside a screen session, you send commands to screen itself!
This command explains how to manage some asynchronous PID in a global process.
The command uses 4 processes in a global process. The asynchronous scripts are simulated by a time.sh script
more infos :