Commands matching what is my ip (241)

  • Waiting for your server to finish rebooting? Issue the command above and you will hear a beep when it comes online. The -i 60 flag tells ping to wait for 60 seconds between ping, putting less strain on your system. Vary it to your need. The -a flag tells ping to include an audible bell in the output when a package is received (that is, when your server comes online).


    119
    ping -i 60 -a IP_address
    haivu · 2009-03-04 06:21:22 28
  • Knock on ports to open a port to a service (ssh for example) and knock again to close the port. You have to install knockd. See example config file below. [options] logfile = /var/log/knockd.log [openSSH] sequence = 3000,4000,5000 seq_timeout = 5 command = /sbin/iptables -A INPUT -i eth0 -s %IP% -p tcp --dport 22 -j ACCEPT tcpflags = syn [closeSSH] sequence = 5000,4000,3000 seq_timeout = 5 command = /sbin/iptables -D INPUT -i eth0 -s %IP% -p tcp --dport 22 -j ACCEPT tcpflags = syn


    34
    knock <host> 3000 4000 5000 && ssh -p <port> user@host && knock <host> 5000 4000 3000
    din7 · 2009-07-28 14:08:01 25
  • Blacklisted is a compiled list of all known dirty hosts (botnets, spammers, bruteforcers, etc.) which is updated on an hourly basis. This command will get the list and create the rules for you, if you want them automatically blocked, append |sh to the end of the command line. It's a more practical solution to block all and allow in specifics however, there are many who don't or can't do this which is where this script will come in handy. For those using ipfw, a quick fix would be {print "add deny ip from "$1" to any}. Posted in the sample output are the top two entries. Be advised the blacklisted file itself filters out RFC1918 addresses (10.x.x.x, 172.16-31.x.x, 192.168.x.x) however, it is advisable you check/parse the list before you implement the rules Show Sample Output


    33
    wget -qO - http://infiltrated.net/blacklisted|awk '!/#|[a-z]/&&/./{print "iptables -A INPUT -s "$1" -j DROP"}'
    sil · 2009-02-18 16:08:23 21
  • I save this to bin/iptrace and run "iptrace ipaddress" to get the Country, City and State of an ip address using the http://ipadress.com service. I add the following to my script to get a tinyurl of the map as well: URL=`lynx -dump http://www.ip-adress.com/ip_tracer/?QRY=$1|grep details|awk '{print $2}'` lynx -dump http://tinyurl.com/create.php?url=$URL|grep tinyurl|grep "19. http"|awk '{print $2}'


    24
    lynx -dump http://www.ip-adress.com/ip_tracer/?QRY=$1|grep address|egrep 'city|state|country'|awk '{print $3,$4,$5,$6,$7,$8}'|sed 's\ip address flag \\'|sed 's\My\\'
    leftyfb · 2009-02-25 17:16:56 26
  • Return IP information about your external ip address with JSON format Show Sample Output


    18
    curl ipinfo.io
    MrTux · 2016-09-04 08:23:25 19
  • We force IPv4, compress the stream, specify the cypher stream to be Blowfish. I suppose you could use aes256-ctr as well for cypher spec. I'm of course leaving out things like master control sessions and such as that may not be available on your shell although that would speed things up as well.


    18
    ssh -4 -C -c blowfish-cbc
    vxbinaca · 2009-12-15 00:30:53 34
  • The command copies a file from remote SSH host on port 8322 with bandwidth limit 100KB/sec; --progress shows a progress bar --partial turns partial download on; thus, you can resume the process if something goes wrong --bwlimit limits bandwidth by specified KB/sec --ipv4 selects IPv4 as preferred I find it useful to create the following alias: alias myscp='rsync --progress --partial --rsh="ssh -p 8322" --bwlimit=100 --ipv4' in ~/.bash_aliases, ~/.bash_profile, ~/.bash_login or ~/.bashrc where appropriate. Show Sample Output


    17
    rsync --progress --partial --rsh="ssh -p 8322" --bwlimit=100 --ipv4 user@domain.com:~/file.tgz .
    ruslan · 2011-02-10 14:25:22 9
  • Sort a list of IPV4 addresses in numerical order. Great as a filter, or within vim using !} Show Sample Output


    14
    sort -nt . -k 1,1 -k 2,2 -k 3,3 -k 4,4
    sysadmn · 2009-02-26 20:22:57 22
  • This appends (-A) a new rule to the INPUT chain, which specifies to drop all packets from a source (-s) IP address.


    12
    iptables -A INPUT -s 222.35.138.25/32 -j DROP
    root · 2009-02-02 12:42:04 76
  • usefull in case of abuser/DoS attacks. Show Sample Output


    12
    netstat -anp |grep 'tcp\|udp' | awk '{print $5}' | sed s/::ffff:// | cut -d: -f1 | sort | uniq -c | sort -n
    dt · 2009-02-15 09:16:16 19
  • Stuck behind a restrictive firewall at work, but really jonesing to putty home to your linux box for some colossal cave? Goodness knows I was...but the firewall at work blocked all outbound connections except for ports 80 and 443. (Those were wide open for outbound connections.) So now I putty over port 443 and have my linux box redirect it to port 22 (the SSH port) before it routes it internally. So, my specific command would be: iptables -t nat -A PREROUTING -p tcp --dport 443 -j REDIRECT --to-ports 22 Note that I use -A to append this command to the end of the chain. You could replace that with -I to insert it at the beginning (or at a specific rulenum). My linux box is running slackware, with a kernel from circa 2001. Hopefully the mechanics of iptables haven't changed since then. The command is untested under any other distros or less outdated kernels. Of course, the command should be easy enough to adapt to whatever service on your linux box you're trying to reach by changing the numbers (and possibly changing tcp to udp, or whatever). Between putty and psftp, however, I'm good to go for hours of time-killing.


    10
    iptables -t nat -A PREROUTING -p tcp --dport [port of your choosing] -j REDIRECT --to-ports 22
    brizznown · 2009-06-18 17:38:59 11
  • On the machine acting like a server, run: iperf -s On the machine acting like a client, run: iperf -c ip.add.re.ss where ip.add.re.ss is the ip or hostname of the server. Show Sample Output


    8
    iperf -s
    forcefsck · 2011-01-24 07:58:38 19
  • Add the QR code image on your webpage, business card ., etc, so people can scan it and quick add to their Contact Address Book. Tested on iPhone with QRreader.


    8
    qrencode -o myqr.png 'MECARD:N:Lee,Chris;TEL:8881234567;EMAIL:chris.lee@somedomain.com;;'
    dynaguy · 2011-07-18 20:22:09 13
  • While `lsof` will work, why not use the tool designed explicitly for this job? (If not run as root, you will only see the names of PID you own) Show Sample Output


    8
    netstat -plnt
    DopeGhoti · 2011-09-30 19:56:32 5
  • Taking file with ip ranges, each on it's own line like: cat ipranges.txt 213.87.86.160-213.87.86.193 213.87.87.0-213.87.88.255 91.135.210.0-91.135.210.255 command returns deaggregated ip ranges using ipcalc deaggregate feature like that: 213.87.86.160/27 213.87.86.192/31 213.87.87.0/24 213.87.88.0/24 91.135.210.0/24 Useful for configuring nginx geo module Show Sample Output


    7
    /bin/grep - ipranges.txt | while read line; do ipcalc $line ; done | grep -v deag
    tf8 · 2010-04-20 21:13:00 4

  • 7
    curl -s https://ipvigilante.com/$(curl -s https://ipinfo.io/ip) | jq '.data.latitude, .data.longitude, .data.city_name, .data.country_name'
    emphazer · 2019-04-26 09:15:00 47
  • This will allow you to watch as matches occur in real-time. To filter out only ACCEPT, DROP, LOG..etc, then run the following command: watch 'iptables -nvL | grep -v "0 0" && grep "ACCEPT"' The -v is used to do an inverted filter. ie. NOT "0 0"


    7
    watch --interval 0 'iptables -nvL | grep -v "0 0"'
    Code_Bleu · 2009-08-22 18:18:05 51

  • 7
    sudo mount -t cifs -o user,username="samba username" //$ip_or_host/$sharename /mnt
    ludogomez · 2009-11-23 15:26:23 8
  • this easy to install tool redirects all traffic to internet through ssh. it's very usefull when connecting to free wifi. you need to start it as root because it needs permissions to change iptables settings. ofcourse you also need a shell account


    6
    sshuttle --dns -vvr user@server 0/0
    andreisid · 2013-10-17 21:46:12 29
  • It really disables all ICMP responses not only the ping one. If you want to enable it you can use: sudo -s "echo 0 > /proc/sys/net/ipv4/icmp_echo_ignore_all"


    6
    sudo -s "echo 1 > /proc/sys/net/ipv4/icmp_echo_ignore_all"
    sliceoflinux · 2010-06-22 19:16:43 14

  • 6
    lsof -Pnl +M -i4
    anhpht · 2011-10-26 15:14:23 5
  • It finds a SNMP OID too :-( Show Sample Output


    5
    alias ip4grep "grep -E '([0-9]{1,3}\.){3}[0-9]{1,3}'"
    azumakuniyuki · 2009-02-09 15:08:16 11
  • Since systemd-resolved was implemented, add a DNS server have become weirder and harder than before. With this command, you can add a DNS server on-the-fly tied to an specific interface


    5
    sudo systemd-resolve --interface <NombreInterfaz> --set-dns <IPDNS> --set-domain mydomain.com
    x3mboy · 2021-09-21 14:43:48 217
  • This will generate 3 paragraphs with random text. Change the 3 to any number. Show Sample Output


    5
    lynx -source http://www.lipsum.com/feed/xml?amount=3|perl -p -i -e 's/\n/\n\n/g'|sed -n '/<lipsum>/,/<\/lipsum>/p'|sed -e 's/<[^>]*>//g'
    houghi · 2010-04-26 17:26:44 5

  • 5
    iptables -nL -v --line-numbers
    jdunn · 2009-02-20 19:48:11 10
  •  1 2 3 >  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

Numerically sorted human readable disk usage
Provides numerically sorted human readable du output. I so wish there was just a du flag for this.

Which processes are listening on a specific port (e.g. port 80)
swap out "80" for your port of interest. Can use port number or named ports e.g. "http"

Split huge file into DVD+R size chunks for burning
Real DVD+R size is 4700372992 bytes, but I round down a little to be safe. To reconstitute use cat. "cat file.img.gz.aa file.img.gz.ab ..... > file.img.gz"

Find the package that installed a command

Delete all but the latest 5 files, ignoring directories

cat stdout of multiple commands
Concatenate the stdout of multiple commands.

Generates a TV noise alike output in the terminal
Generates a TV noise alike output in the terminal. Can be combined with https://www.commandlinefu.com/commands/view/9728/make-some-powerful-pink-noise

check open ports without netstat or lsof

Check command history, but avoid running it
!whatever will search your command history and execute the first command that matches 'whatever'. If you don't feel safe doing this put :p on the end to print without executing. Recommended when running as superuser.

Convert file type to unix utf-8
converts encoding of a file to unix utf-8 useful for data files that contain what would be usable ascii text but are encoded as mpeg or some other encoding that prevents you from doing common manipulations like 'sed'


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: