Commands using head (314)

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

Listing today’s files only

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"

git remove files which have been deleted
I've used technicalpickles command a lot, but this one handles whitespaces in filenames. I'm sure you want to create an alias for it :)

check open ports
Tested in Linux and OSX

Disable sending of start/stop characters
This command disable sending of start/stop characters. It's useful when you want to use incremental reverse history search forward shortcut (Ctrl+s). To enable again, type: $ stty -ixoff

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"

tail: watch a filelog
-f file(s) to be monitorized -n number of last line to be printed on the screen in this example, the content of two files are displayed

Stop long commands wrapping around and over-writing itself in the Bash shell
add the command either in /etc/profile or ~/.bash_profile so that this is available to your shell.

Print github url for the current url
Works for repos cloned via ssh or https.

launch bash without using any letters
I don't know why anyone would use this, I was just messing around tonight and managed to start bash without using any letters and thought I would share. It's pretty simple, first it tries to execute "-" redirecting stderr to stdout which prints the error "bash: -: command not found" to standard output, then I try to execute "bash: -: command not found" which produces the output "bash: bash: -: command not found: command not found". lastly, (on the other side of the semicolon) I use the underscore environment variable which refers to the last command run ("bash: -: command not found") and take out everything after the first ":" character using brace expressions and your left with "bash"


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: