Commands using export (101)

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

Socksify any program to avoid restrictive firwalls
Require: - tsocks (deb pkg) - A working SOCKS proxy. It's easy with ssh: $ ssh -N -D localhost:1080 your.home.pc -p 443 - tsocks configuration in your /etc/tsocks.conf (for the previous): server = 127.0.0.1 server_port = 1080

check open ports without netstat or lsof

Get IPv4 of eth0 for use with scripts
Simple and easy. No regex, no search and replace. Just clean, built-in tools.

find all active IP addresses in a network
I just added the args [arp-scan --localnet] which works for Debian users, because the package 'arp' has name 'arp-scan', and it doesn't works with the argument 'arp'.

Time conversion/format using the date command

Add a progress counter to loop (see sample output)
For this hack you need following function: $ finit() { count=$#; current=1; for i in "$@" ; do echo $current $count; echo $i; current=$((current + 1)); done; } and alias: $ alias fnext='read cur total && echo -n "[$cur/$total] " && read' Inspired by CMake progress counters.

Use Linux coding style in C program
put "-linux" option into $HOME/.indent.pro to make it default

Create a mirror of a local folder, on a remote server
Create a exact mirror of the local folder "/root/files", on remote server 'remote_server' using SSH command (listening on port 22) (all files & folders on destination server/folder will be deleted)

Find the package that installed a command

Download SSL server certificate with opsnessl
Useful when we need to create new certificate for site when current one is near expiry. This downloaded cert can be used to provide organisational data directly to new cert. using below command. e.g. openssl x509 -x509toreq -in /tmp/example.com.cert -out example.com.csr -signkey example.com-key.pem


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: