Commands by ene2002 (9)

  • see the partition Show Sample Output


    -4
    fdisk -l
    ene2002 · 2014-02-16 12:54:38 8

  • -2
    nmap -sS -O -v -oS - 192.168.2.0/24
    ene2002 · 2014-01-31 18:04:06 151
  • Watch a dig in progress Show Sample Output


    1
    watch -n1 dig google.com
    ene2002 · 2013-12-26 19:23:27 13
  • I wanted an easy way to list out the sizes of directories and all of the contents of those directories recursively. Show Sample Output


    1
    du -h --max-depth=1 /path/folder/
    ene2002 · 2013-07-09 19:56:13 105
  • UBNT iwlist command Show Sample Output


    -2
    iwlist ath0 scanning |egrep '(ESSID|Signal|Address)'| \sed -e 's/Cell - Address:*//g' -e 's/ESSID://g' \-e 's/Noise level=-//g' -e 's/dBm//g' \-e 's/Quality=*//g' -e 's/Signal level=-//g' \-e 's/"//g'
    ene2002 · 2013-05-04 08:48:45 19
  • This works just as well for SMTP. You could run this on your mail server to watch e-mail senders and recipients: tcpdump -l -s0 -w - tcp dst port 25 | strings | grep -i 'MAIL FROM\|RCPT TO' Show Sample Output


    4
    tcpdump -l -s0 -w - tcp dst port 25 | strings | grep -i 'MAIL FROM\|RCPT TO'
    ene2002 · 2013-03-18 18:55:20 184

  • 1
    nmap -T4 --script broadcast-pppoe-discover 192.168.122.0/24
    ene2002 · 2013-02-18 13:26:48 3

  • 0
    tcpdump -i eth0 -s 65535 -w test_capture
    ene2002 · 2013-02-07 19:29:02 4

  • 1
    tcpdump -i eth0 port http or port smtp or port imap or port pop3 -l -A | egrep -i 'pass=|pwd=|log=|login=|user=|username=|pw=|passw=|passwd=|password=|pass:|user:|userna me:|password:|login:|pass |user '
    ene2002 · 2013-02-07 19:14:58 4

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

Get the IP address of a machine. Just the IP, no junk.
Why use many different utilities all piped together, when you only need two?

Audible warning when a downloading is finished
This command can be set as an alias in ~/.bashrc For example (in my case) I have : alias watchDl='while [ "$(ls $filePart)" != "" ]; do sleep 5; done; mpg123 /home/.../warning.mp3" ' Then I just need to - initialize filePart (e.g. filePart="*bigFile*rar.part") - launch watchDl

In (any) vi, add a keystroke to format the current paragraph.
That goes into your $HOME/.exrc file. " Nice macro to reformat lines: map ^A !}fmt Note that the ^A has to be input by typing ^V^A.

firefox: how many eat?

Convert seconds to [DD:][HH:]MM:SS
Converts any number of seconds into days, hours, minutes and seconds. sec2dhms() { declare -i SS="$1" D=$(( SS / 86400 )) H=$(( SS % 86400 / 3600 )) M=$(( SS % 3600 / 60 )) S=$(( SS % 60 )) [ "$D" -gt 0 ] && echo -n "${D}:" [ "$H" -gt 0 ] && printf "%02g:" "$H" printf "%02g:%02g\n" "$M" "$S" }

Enter parameter if empty (script becomes interactive when parameters are missing)
Can be used for command line parameters too. If you have a more complicated way of entering values (validation, GUI, ...), then write a function i.e. EnterValue() that echoes the value and then you can write: $ param=${param:-$(EnterValue)}

check open ports without netstat or lsof

Find usb device in realtime
Using this command you can track a moment when usb device was attached.

A random password generator

Create a bunch of dummy files for testing
Sometimes I need to create a directory of files to operate on to test out some commandlinefu I am cooking up. The main thing is the range ({1..N}) expansion.


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: