Hide

What's this?

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.


Get involved!

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.

UpGuard checks and validates configurations for every major OS, network device, and cloud provider.
Hide

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:

Hide

News

May 19, 2015 - A Look At The New Commandlinefu
I've put together a short writeup on what kind of newness you can expect from the next iteration of clfu. Check it out here.
March 2, 2015 - New Management
I'm Jon, I'll be maintaining and improving clfu. Thanks to David for building such a great resource!
Hide

Top Tags

Hide

Functions

Commands by erez83 from sorted by
Terminal - Commands by erez83 - 14 results
ssh-keygen -b 4048 -t rsa -C "comment"
2016-02-03 09:37:39
User: erez83
Functions: ssh ssh-keygen
Tags: ssh centos
0

Generating ssh key

then need to copy public key in to /root/.ssh/authorized_keys

tcpdump -nqt -s 0 -A -i eth0 port 5060
s3cmd du s3://bucket-name | awk '{print $0/1024/1024/1024" GB"}'
tcpdump -i eth1 -s0 -v -w /tmp/capture_`date +%d_%m_%Y__%H_%I_%S`.pcap
tcpdump -i eth1 -s0 -v -w /tmp/capture.pcap
2015-10-21 09:14:26
User: erez83
Functions: tcpdump
0

capture trafic for wireshark from spesific eth interface

unzip -l files.zip
2015-10-15 07:07:42
User: erez83
-1

View files in ZIP archive

unzip -l files.zip

unzip -j "myarchive.zip" "in/archive/file.txt" -d "/path/to/unzip/to"
2015-10-15 07:06:19
User: erez83
0

Extract only a specific file from a zipped archive to a given directory

unzip -j "myarchive.zip" "in/archive/file.txt" -d "/path/to/unzip/to"

unzip /surce/file.zip -d /dest/
du -h --max-depth=1 /home/ | sort -n
-A INPUT -p tcp --dport 22 -m mac --mac-source 3E:D7:88:A6:66:8E -j ACCEPT
2015-09-17 14:51:47
User: erez83
0

-A INPUT -p udp -m udp --dport 10000:66000 -m mac --mac-source 3E:D7:88:A6:66:8E -j ACCEPT

-A INPUT -p udp -m udp --dport 5060 -m mac --mac-source 3E:D7:88:A6:66:8E -j ACCEPT

-A INPUT -p tcp --dport 22 -m mac --mac-source 3E:D7:88:A6:66:8E -j ACCEPT

zip -r /tmp/filename-`date +%Y%m%d_%H%M%S`.zip /directory/
find . -name '*.php' | xargs wc -l
2014-12-24 11:15:18
User: erez83
Functions: find wc xargs
Tags: count code
0

count all the lines of code in specific directory recursively

in this case only *.php

can be *.*

mysql -u{user} -p{password} -Ne "select distinct concat( \"SHOW GRANTS FOR '\",user,\"'@'\",host,\"';\" ) from user;" mysql | mysql -u {user} -p{password} | sed 's/\(GRANT .*\)/\1;/;s/^\(Grants for .*\)/## \1 ##/;/##/{x;p;x;}'
netstat -anp | grep ":<port>"