Commands tagged multiple (9)

  • Given some images (jpg or other supported formats) in input, you obtain a single PDF file with an image for every page.


    19
    convert *.jpg output.pdf
    fazen · 2010-10-10 15:41:03 15
  • I needed a way to search all files in a web directory that contained a certain string, and replace that string with another string. In the example, I am searching for "askapache" and replacing that string with "htaccess". I wanted this to happen as a cron job, and it was important that this happened as fast as possible while at the same time not hogging the CPU since the machine is a server. So this script uses the nice command to run the sh shell with the command, which makes the whole thing run with priority 19, meaning it won't hog CPU processing. And the -P5 option to the xargs command means it will run 5 separate grep and sed processes simultaneously, so this is much much faster than running a single grep or sed. You may want to do -P0 which is unlimited if you aren't worried about too many processes or if you don't have to deal with process killers in the bg. Also, the -m1 command to grep means stop grepping this file for matches after the first match, which also saves time. Show Sample Output


    10
    sh -c 'S=askapache R=htaccess; find . -mount -type f|xargs -P5 -iFF grep -l -m1 "$S" FF|xargs -P5 -iFF sed -i -e "s%${S}%${R}%g" FF'
    AskApache · 2009-10-02 05:03:10 8
  • After running firefox -ProfileManager and creating several different profiles, use this command to run multiple Firefox profiles simultaneously.


    5
    firefox -P <profile_name> -no-remote
    mariusbutuc · 2010-08-25 19:14:10 5
  • dsh - Distributed shell, or dancer?s shell ;-) you can put your servers into /etc/dsh/machines.list than you don't have to serperate them by commata or group them in different files and only run commands for this groups dsh -M -c -a -- "apt-get update" Show Sample Output


    4
    dsh -M -c -f servers -- "command HERE"
    foob4r · 2009-08-31 12:08:38 3
  • There's other expansions as well such as `{one,two,three}'. Check the curl docs for more.


    0
    curl -O "http://www.dspguide.com/CH[1-34].PDF"
    CMCDragonkai · 2015-11-26 06:34:40 13
  • If you need to create a profile and are already running Firefox, you don't need to close it to do it. Also, if you don't know the exact name of the profile, this would allow you to pick from a list.


    -2
    firefox -ProfileManager -no-remote
    wdszdwsdzfxdgfrd · 2010-10-08 14:40:18 4
  • A much shorter version of this command.


    -3
    sed -i "s/\s*/ /g;s/\s*$//" input_file
    gitterrost4 · 2011-12-12 10:58:33 7
  • Yeah, there are many ways to do that. Doing with sed by using a for loop is my favourite, because these are two basic things in all *nix environments. Sed by default does not allow to save the output in the same files so we'll use mv to do that in batch along with the sed. Show Sample Output


    -4
    for files in $(ls -A directory_name); do sed 's/search/replaced/g' $files > $files.new && mv $files.new $files; done;
    bassu · 2009-05-07 20:13:07 48
  • This command does the following: - converts any sequence of multiple spaces/tabs to one space only - completely removes any space(s)/tab(s) at the end of each line (If spaces and tabs are mixed in a sequence i.e. [tab][tab][space][tab], you have to execute this command twice!) Show Sample Output


    -4
    sed -i "s/\(\x09\{1,\}\)\|\( \{1,\}\)/ /g;s/\(\x09\{1,\}$\)\|\( \{1,\}$\)//g" brisati.txt
    knoppix5 · 2011-12-12 10:24:03 7

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

online MAC address lookup

Equivalent to ifconfig -a in HPUX
Command is properly working on HP-UX 11.31

find the longest command in your history

Monitor the queries being run by MySQL
Watch is a very useful command for periodically running another command - in this using mysqladmin to display the processlist. This is useful for monitoring which queries are causing your server to clog up. More info here: http://codeinthehole.com/archives/2-Monitoring-MySQL-processes.html

Displays the version of the Adobe Flash plugin installed
This is for Debian, simply change the path if your Flash plugin is installed elsewhere.

Edit a google doc with vim
Google just released a new commend line tool offering all sorts of new services from the commend line. One of them is uploading a youtube video but there are plenty more google services to interact with. Download it here: http://code.google.com/p/googlecl/ Manual: http://code.google.com/p/googlecl/wiki/Manual This specific command courtesy of lifehacker:http://lifehacker.com/5568817/ Though all can be found in manual page linked above.

holafiesta webradio
musica nel cuore dove c'? musica note di emozioni

Convert seconds to [DD:][HH:]MM:SS
Converts any number of seconds into days, hours, minutes and seconds. sec2dhms() { declare -i SS="$1" D=$(( SS / 86400 )) H=$(( SS % 86400 / 3600 )) M=$(( SS % 3600 / 60 )) S=$(( SS % 60 )) [ "$D" -gt 0 ] && echo -n "${D}:" [ "$H" -gt 0 ] && printf "%02g:" "$H" printf "%02g:%02g\n" "$M" "$S" }

Watch Aljazeera live

SSH to a machine's internet address if it is not present on your local network
Ping machine once, waiting 1 second for response until failing. Upon fail, ssh globally, otherwise ssh locally.


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: