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.
» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10
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:
Umask is obtained subtracting 7 from each cypher of octal format. I store octal perm format in an array,then for each element of array I subtract 7. The result is the umask.
I'm sure almost everybody knows this by now. This command will pull the password for the admin login of any plesk machine.
I use this for connect via sftp to a server listening on a non default ssh port.
The socket.gethostname() call returns the host name of the computer. The socket.gethostbyname_ex() call returns a list of three items: The host name, the list of aliases for this host, and a list of IP addresses. Recall that Python?s array starts with index 0, the socket.gethostbyname_ex(?)[2] expression refers to the list of IP addresses. Finally, the print statement prints out the IP addresses, one per line.
Shred can be used to shred a given partition or an complete disk. This should insure that not data is left on your disk
Ok so it's rellay useless line and I sorry for that, furthermore that's nothing optimized at all...
At the beginning I didn't managed by using netstat -p to print out which process was handling that open port 4444, I realize at the end I was not root and security restrictions applied ;p
It's nevertheless a (good ?) way to see how ps(tree) works, as it acts exactly the same way by reading in /proc
So for a specific port, this line returns the calling command line of every thread that handle the associated socket
ifstat, part of ifstat package, is a tool for displaying bandwidth and other statistics. The -n option avoid to display header periodically, the -t option put a timestamp at the beginning of the line.
Works for me on Debian and CentOS
Change your wallpaper every thirty minutes (or however long you like, I suppose) to a randomly selected image in a directory and subdirectories. Bear in mind this is not safe to use if anyone else has write access to your image directory.
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
ID_FS_USAGE=other
ID_FS_TYPE=swap
ID_FS_VERSION=2
ID_FS_UUID=27fca13d-97b7-4d28-882c-6d03353f0a82
ID_FS_UUID_ENC=27fca13d-97b7-4d28-882c-6d03353f0a82
ID_FS_LABEL=
ID_FS_LABEL_ENC=
Simply changes the wallpaper of xfce4 from the command line. Not for multiple displays.
This works just like write or wall ... cept one thing the sender is anonymous ... if you really want to drive everyone insane replace echo \"The Matrix has you...\" with cat /dev/urandom
nice one to do on April fool's day
use today's time stamp to make a unique directory for today or an hour ago ...
If histappend options is set in bash, the file .bash_history will not be overwrite and history list is append to it.
Also with optional message:
echo "no login for you" > /etc/nologin
(This doesn't affect your current X session - you're already logged in!)
Works on CentOS ad OpenBSD too, display time of accounts connection on a system, -p option print individual user's statistics.
You can use this in a script which rotates wallpapers from a directory at each login.
Do you have an entire album in a unique file and want to split it in individual tracks? If you also have the cue file you can do it!
Packages for Debian-based systems users:
* cuetools shntool
* FLAC (.flac): flac
* WavPack (.wv): wavpack
* Monkey's Audio (.ape): libmac2 monkeys-audio (deb http://www.debian-multimedia.org sid main)
NOTE: "sid" packages are unstable, but I didn't have problems with them. If you prefer, use the "stable" version repository.
To transfer the tags, you can use this (works with .flac, .ogg and .mp3):
cuetag sample.cue split-track*.flac
The title is optional.
Options:
-t: expire time in milliseconds.
-u: urgency (low, normal, critical).
-i: icon path.
On Debian-based systems you may need to install the 'libnotify-bin' package.
Useful to advise when a wget download or a simulation ends. Example:
wget URL ; notify-send "Done"
txt2regex can be interactive or noninteractive and generates regular expressions for a variety of dialects based on user input. In interactive mode, the regex string builds as you select menu options. The sample output here is from noninteractive mode, try running it standalone and see for yourself. It's written in bash and is available as the 'txt2regex' package at least under debian/ubuntu.