Commands by magicjohnson_ (5)

  • Add dirs to list: pushd /tmp /tmp ~ then cd - /home/user cd - /tmp


    -1
    cd -
    magicjohnson_ · 2011-07-05 05:28:32 2
  • Convert DOS newlines (CR/LF) to Unix format using sed command


    2
    sed 's/^M$//' input.txt > output.txt
    magicjohnson_ · 2011-02-14 03:45:43 2

  • 2
    echo ::memstat | mdb -k
    magicjohnson_ · 2010-12-29 11:19:14 0

  • 2
    find /etc/rc3.d/ | sort -g
    magicjohnson_ · 2010-12-06 03:45:01 3
  • It works in every linux box Show Sample Output


    -1
    cat /proc/cpuinfo
    magicjohnson_ · 2010-09-24 09:27:58 0

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

print text in color red
eg: $printTextInColorRed foo bar foo bar [in red color]

chmod - change file permissions of a file to be similar of another

Connect to TCP port 5000, transfer data and close connexion.
With no '-q 0' switch, nc simply waits, and whatever awaits the data hangs.

get only time of execution of a command without his output

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"

left-right mouse buttons (left-handed)

LIST FILENAMES OF FILES CREATED TODAY IN CURRENT DIRECTORY
This version eliminates the grep before the awk, which is always good. It works for GNU core utils and ensures that the date output of ls matches the format in the pattern match, regardless of locale, etc. On BSD-based systems, you can easily eliminate both the grep and the awk: find . -maxdepth 1 -Btime -$(date +%kh%lm) -type f

Zip a directory on Mac OS X and ignore .DS_Store (metadata) directory
If you want to generate a cross-platform compatible zip file and ignore the Finder's hidden metadata directory

Get AWS temporary credentials ready to export based on a MFA virtual appliance
You might want to secure your AWS operations requiring to use a MFA token. But then to use API or tools, you need to pass credentials generated with a MFA token. This commands asks you for the MFA code and retrieves these credentials using AWS Cli. To print the exports, you can use: `awk '{ print "export AWS_ACCESS_KEY_ID=\"" $1 "\"\n" "export AWS_SECRET_ACCESS_KEY=\"" $2 "\"\n" "export AWS_SESSION_TOKEN=\"" $3 "\"" }'` You must adapt the command line to include: * $MFA_IDis ARN of the virtual MFA or serial number of the physical one * TTL for the credentials

find all non-html files


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: