All commands (14,187)

  • I must monitorize a couple of ftp servers every morning WITHOUT a port-scanner Instead of ftp'ing on 100 ftp servers manually to test their status I use this loop. It might be adaptable to other services, however it may require a 'logout' string instead of 'quit'. The file ftps.txt contains the full list of ftp servers to monitorize.


    1
    for host in $(cat ftps.txt) ; do if echo -en "o $host 21\nquit\n" |telnet 2>/dev/null |grep -v 'Connected to' >/dev/null; then echo -en "FTP $host KO\n"; fi done
    vlan7 · 2010-01-26 15:34:18 3
  • Recursive grep through directory for file.


    -5
    find directory/ |xargs grep -i "phrase"
    tuxtutorials · 2010-01-26 14:56:56 3
  • no loop, only one call of grep, scrollable ("less is more", more or less...)


    12
    ls /usr/bin | xargs whatis | grep -v nothing | less
    michelsberg · 2010-01-26 12:59:47 31
  • Useful for Maven multimodule projects, where you want to extract all packaged jar files.


    -3
    find . -iname "*.jar" -exec cp '{}' /tmp/ \;
    unixmonkey6754 · 2010-01-26 12:19:15 3
  • This command has been used to overwrite corrupted "entries" files of a corrupted subversion working copy. Note the --files-from input format.


    3
    rsync -vd --files-from=<(find . -name entries -print ) . ../target_directory
    samyboy · 2010-01-26 09:41:12 6
  • This command toggles the touchpad on and off, when it's on, the right side scroll strip (annoying) and the tap-clicking are disabled, you can change this by changing occurances of 2 in the command to 0. this whole command can then be given a keyboard shortcut so that the touchpad is disableable without using a special fn key (which linux doesn't recognize on some computers) or a seperate button.


    -3
    if [ $(synclient -l | grep TouchpadOff | awk '{print $3}') = "2" ]; then synclient TouchpadOff=1; elif [ $(synclient -l | grep TouchpadOff | awk '{print $3}') == "1" ]; then synclient TouchpadOff=2; else synclient TouchpadOff=2; fi
    GinoMan2440 · 2010-01-26 07:52:55 5

  • 1
    find . -maxdepth 1 -type d -exec 'mv "{}" "{}-old" && svnadmin create "{}" && svnadmin recover "{}-old" && svnadmin dump "{}-old" | svnadmin load "{}" && rm -rf "{}-old"' \;
    raspi · 2010-01-26 07:06:43 3

  • 7
    for i in $(ls /usr/bin); do whatis $i | grep -v nothing; done | more
    Abiden · 2010-01-26 06:15:54 6

  • -2
    7za x \*.zip
    andrew112358 · 2010-01-25 21:50:15 2
  • Traditionally we rewind a tape using this syntaxis: mt -f /dev/rmt/0cbn rewind Redirecting the dispositive to nothing as shown above is faster. Less typing is always better.


    2
    < /dev/rmt/0cbn
    vlan7 · 2010-01-25 20:32:38 3

  • -1
    find . -maxdepth 1 -type f| xargs sha1sum | sed 's/^\(\w*\)\s*\(.*\)/\2 \1/' | while read LINE; do mv $LINE; done
    foremire · 2010-01-25 20:21:01 11
  • for example if you did a: ls -la /bin/ls then ls !$ is equivalent to doing a ls /bin/ls


    9
    !$
    ringlerun · 2010-01-24 17:59:52 22
  • running top command in batch mode. it is usefull if you want to redirect the output in a file. Show Sample Output


    2
    top -b -n 1
    r00t4u · 2010-01-24 16:17:30 5

  • 0
    dpkg -l | grep ^rc | awk '{print $2}' | sudo xargs dpkg -P
    kayowas · 2010-01-24 14:23:37 4
  • Use find's built-in ability to call programs. Alternatively, find -maxdepth 1 -type f -name "*.7z" -print0 | xargx -0 -n 1 7zr e would work, too.


    -1
    find -maxdepth 1 -type f -name "*.7z" -exec 7zr e '{}' ';'
    minnmass · 2010-01-23 19:50:10 4

  • 0
    find . -type f -exec stat \{\} \; | grep Modify: | awk '{a[$2]++}END{for(i in a){print i " : " a[i] }}' | sort
    pepin · 2010-01-23 07:55:16 6
  • Restores the keyboard so your partner who expects the keys to correspond to what they're labelled can type (in qwerty).


    -2
    setxkbmap us
    keturn · 2010-01-23 04:08:46 4
  • What to type to fix the keyboard when it's all qwerty and/or the modifier key to the left of the 'a' is doing something unexpected. In addition, I've also been known to use the altwin:meta_win and compose:ralt flags.


    0
    setxkbmap dvorak '' ctrl:nocaps
    keturn · 2010-01-23 04:04:59 3
  • A command to post a message to Twitter that includes your geo-location and a short URL. The link shortening service is provide by TinyURL, the geo-location service is provided by HostIP and the IP address lookup service is provided by AppSpot. This is an upgrade of an of one of my previous contributions: http://tinyurl.com/yd2xtzv.


    4
    curl --user "USERNAME:PASSWORD" -d status="MESSAGE_GOES_HERE $(curl -s tinyurl.com/api-create.php?url=URL_GOES_HERE) $(curl -s api.hostip.info/get_html.php?ip=$(curl ip.appspot.com))" -d source="cURL" twitter.com/statuses/update.json -o /dev/null
    o0110o · 2010-01-23 02:21:57 10

  • -7
    scp /home/svnlabs.txt root@92.178.0.56:/home/
    bakhru · 2010-01-22 21:19:37 5

  • 10
    nmap -T4 -sP 192.168.2.0/24 && egrep "00:00:00:00:00:00" /proc/net/arp
    wincus · 2010-01-22 20:36:43 7

  • 3
    for file in *.7z; do 7zr e "$file"; done
    jmcantrell · 2010-01-22 18:42:20 11
  • Connect EC2 server with public keys "/root/.ec2/id_rsa-gsg-keypair" or "/root/.ec2/keypair.pem"


    -2
    rsync -avvvz -e "ssh -i /root/.ec2/id_rsa-gsg-keypair" --archive --progress /root/.ec2/id_rsa-gsg-keypair root@ec2-75-101-212-113.compute-1.amazonaws.com:/root
    lalit241 · 2010-01-22 17:21:58 3
  • Upload file to remote server using SCP


    -9
    scp -P 22 /home/svnlabs.txt root@92.178.0.56:/home/svnlabs.txt
    lalit241 · 2010-01-22 17:21:07 3
  • Upload file to remote server using SCP


    -6
    scp -P 22 /home/svnlabs.txt root@92.178.0.56:/home/svnlabs.txt
    svnlabs · 2010-01-22 16:55:25 4
  • ‹ First  < 406 407 408 409 410 >  Last ›

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

force unsupported i386 commands to work on amd64
The above was done using the i386 flashplayer plugin, and was installed on a AMD64 machine running an AMD64 kernel and AMD64 programs. the resulting plugin install ultimately didn't work for swiftfox (but worked for iceweasel) without also covering it with a nspluginwrapper which took a bit of fenangaling to get to work (lots of apt-getting) but it is a nice feature to be able to trick installers that think you need i386 into running on a amd64, or at least attempting to run on amd64. Enjoy

Gets the english pronunciation of a phrase
Usage examples: say hello say "hello world" say hello+world

Generat a Random MAC address
Generate a random MAC address with capital letters

Extract tarball from internet without local saving

Check whether laptop is running on battery or cable
The original proc file doesn't exist on my system.

Install pip with Proxy
Installs pip packages defining a proxy

Send a local file via email
This just reads in a local file and sends it via email. Works with text or binary. *Requires* local mail server.

dont execute command just add it to history as a comment, handy if your command is not "complete" yet

list files recursively by size

Get the IP address
gives u each configured IP in a seperate line.


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: