Commands tagged aliase (1)

  • # newline to space; the whack before dollar-underbar is required alias nl2space="perl -ne 'push @F, \$_; END { chomp @F; print join(qq{ }, @F) , qq{\n};}' " # newline to comma; the whack before dollar-underbar is required alias nl2,="perl -ne 'push @F, \$_; END { chomp @F; print join(qq{,}, @F) , qq{\n};}' " PROMPT> cat /tmp/foo foo-001 foo-002 foo-003 foo-004 foo-005 foo-006 foo-007 foo-008 foo-009 foo-010 # 'tr' does not give a newline after it run. Makes a messy commandline. PROMPT> cat /tmp/foo|tr "\n" ' ' foo-001 foo-002 foo-003 foo-004 foo-005 foo-006 foo-007 foo-008 foo-009 foo-010 $PROMPT> tr "\n" ' ' /tmp/foo # 'tr' does not take arguements PROMPT> tr "\n" ' ' /tmp/foo tr: extra operand `/tmp/foo' Try `tr --help' for more information. # 'nl2space' is a filter and takes arguements, adds a newline after it runs. PROMPT> cat /tmp/foo| nl2space foo-001 foo-002 foo-003 foo-004 foo-005 foo-006 foo-007 foo-008 foo-009 foo-010 PROMPT> nl2space /tmp/foo foo-001 foo-002 foo-003 foo-004 foo-005 foo-006 foo-007 foo-008 foo-009 foo-010


    0
    alias nl2space="perl -ne 'push @F, \$_; END { chomp @F; print join(qq{ }, @F) , qq{\n};}' "
    relay · 2009-10-01 02:22:23 6

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

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)

Alias for lazy tmux create/reattach
If a tmux session is already running attach it, otherwise create a new one. Useful if you often forget about running tmuxes (or just don't care)

Install a LAMP server in a Debian based distribution
The execution of this command will install a LAMP server (Linux, Apache, MySQL and PHP) in a Debian based distribution. For example, in Ubuntu.

find text in a file
this will find text in the directory you specify and give you line where it appears.

locating packages held back, such as with "aptitude hold "
locating packages held back, such as with "aptitude hold "

Use tee to process a pipe with two or more processes
Tee can be used to split a pipe into multiple streams for one or more process to work it. You can add more " >()" for even more fun.

back ssh from firewalled hosts
host B (you) redirects a modem port (62220) to his local ssh. host A is a remote machine (the ones that issues the ssh cmd). once connected port 5497 is in listening mode on host B. host B just do a ssh 127.0.0.1 -p 5497 -l user and reaches the remote host'ssh. This can be used also for vnc and so on.

Get your external IP address ( 10 characters long )
Shortest url to a external IP-service, 10 characters.

execute your commands and avoid history records
$ secret_command;export HISTCONTROL= This will make "secret_command" not appear in "history" list.

Show what PID is listening on port 80 on Linux


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: