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.


If you have a new feature suggestion or find a bug, please get in touch via http://commandlinefu.uservoice.com/

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.

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

2011-03-12 - Confoo 2011 presentation
Slides are available from the commandlinefu presentation at Confoo 2011: http://presentations.codeinthehole.com/confoo2011/
2011-01-04 - Moderation now required for new commands
To try and put and end to the spamming, new commands require moderation before they will appear on the site.
2010-12-27 - Apologies for not banning the trolls sooner
Have been away from the interwebs over Christmas. Will be more vigilant henceforth.
2010-09-24 - OAuth and pagination problems fixed
Apologies for the delay in getting Twitter's OAuth supported. Annoying pagination gremlin also fixed.
Hide

Tags

Hide

Functions

Commands by tiagofischer from sorted by
Terminal - Commands by tiagofischer - 11 results
unhide (proc|sys|brute)
2010-12-16 13:05:10
User: tiagofischer
Tags: unhide
0

Unhide is a forensic tool to find processes and TCP/UDP ports hidden by rootkits, Linux kernel modules or by other techniques. It includes two utilities: unhide and unhide-tcp.

ps h -o pid,command | grep 'TEXT' | sed 's/^ \+//' | cut -d ' ' -f 1 | xargs -n 1 kill
ipcs -a | grep 0x | awk '{printf( "-Q %s ", $1 )}' | xargs ipcrm
sed -i -e 's/war/peace/g' *
2010-01-02 13:16:35
User: tiagofischer
Functions: sed
0

Replace the word 'war' to word 'peace' in every file in the current directory.

ipcs
2009-12-09 12:30:00
User: tiagofischer
Functions: ipcs
1

Get information about Shared Memory Segments, Semaphore Arrays and Message Queues.

Summary:

ipcs -u
ccze
2009-11-23 15:54:33
User: tiagofischer
30

CCZE is a robust and modular log coloriser, with plugins for apm, exim, fetchmail, httpd, postfix, procmail, squid, syslog, ulogd, vsftpd, xferlog and more.

Examples:

tail -f /var/log/messages | ccze -A

tail -f /var/log/exim4/mainlog | ccze -A

rcconf
2009-11-23 14:32:43
User: tiagofischer
1

This tool configures system services in connection with system runlevels. It turns on/off services using the scripts in /etc/init.d/.

Rcconf works with System-V style runlevel configuration.

It is a TUI(Text User Interface) frontend to the update-rc.d command.

lockfile
2009-11-23 12:07:07
User: tiagofischer
Functions: lockfile
4

Programs for locking and unlocking files and mailboxes.This package includes several programs to safely lock and unlock files and mailboxes from the command line. These include:

lockfile-create

lockfile-remove

lockfile-touchlock

mail-lock

mail-unlock

mail-touchlock

These programs use liblockfile to perform the file locking and unlocking, so they are guaranteed compatible with Debian's file locking policies.

On target: "nc -l 4000 | tar xvf -" On source: "tar -cf - . | nc target_ip 4000"
2009-06-30 19:36:19
User: tiagofischer
Tags: tar nc
5

It bypasses encryption overhead of SSH and depending on configuration can be significantly faster.

It's recommended to use only in trusted networks.

netstat -ntu | awk '{print $5}' | cut -d: -f1 | sort | uniq -c | sort -n
2009-03-28 21:02:26
User: tiagofischer
Functions: awk cut netstat sort uniq
14

Here is a command line to run on your server if you think your server is under attack. It prints our a list of open connections to your server and sorts them by amount.

BSD Version:

netstat -na |awk '{print $5}' |cut -d "." -f1,2,3,4 |sort |uniq -c |sort -nr
unzip \*.zip
2009-03-26 02:36:28
User: tiagofischer
Tags: unzip
-4

"unzip *.zip" doesn't work as expected, because unzip handle wildcards in a different way.

You just need to escape the wildcard or do in another way:

for f in *.zip; do unzip "$f"; done