Commands tagged save (4)

  • Faster then other method using wget For obtain all commands use nu=`curl |grep -o "Terminal - All commands -.*results$" | grep -oE "[[:digit:],]{4,}" | sed 's/,//'`; curl[0-"$nu":25] | grep -vE "_curl_|\.com by David" > clf-ALL.txt For more version specific nu=`curl |grep -o "Terminal - All commands -.*results$" | grep -oE "[[:digit:],]{4,}" | sed 's/,//'`; curl[0-"$nu":25] | grep -vE "_curl_|\.com by David" > clf-ALL_"$nu".txt Also download dirctly from my dropbox My drop box invitaion link is . Use it and get free 2.5 GB space. Show Sample Output

    curl[0-9000:25] | grep -vE "_curl_|\.com by David" > clf-ALL.txt
    totti · 2011-11-08 12:19:48 0
  • The simpler, 1-arg version is save_function(){ { date +"# %F.%T $1; declare -f "$1";}| tee -a ~/.bash_functions; }` Show Sample Output

    save_function(){ while [[ $# > 0 ]]; do { date +"# %F.%T $1; declare -f "$1";}| tee -a ~/.bash_functions; shift; done;}
    mcint · 2019-07-17 01:06:59 0

  • 0
    :w !sudo tee %
    KodjoSuprem · 2013-09-25 08:56:21 0
  • 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

    for files in $(ls -A directory_name); do sed 's/search/replaced/g' $files > $ && mv $ $files; done;
    bassu · 2009-05-07 20:13:07 6

What's this? 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

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"

list block devices
Shows all block devices in a tree with descruptions of what they are.

Down for everyone or just me?
Check if a site is down with

Rename files in batch

Backup files older than 1 day on /home/dir, gzip them, moving old file to a dated file.
Useful for backing up old files, custom logs, etc. via a cronjob.

resolve short urls
since the most url shorteners respond with a header containing the Location: ... this works with most common shorteners

Stream the latest offering from your fave netcasts/podcasts
This is a quick line to stream in the latest offerings of your favorite netcasts/podcasts. You will need to have a file named netcast.txt in the directory you run this from. This file should have one and only one of your netcast's/podcst's url per line. When run the line grabs the offering on the top of the netcast/podcast stack and end it over , quietly, to vlc. Since I move around computers during the day I wanted an easy way to listen to my daily dose of news and such without having to worry about downloading to whatever machine I am on. This is just a quick grab and stream of whats current. Future plans... have the list of netcasts be read from the web. possibly an rss or such. I use greader so there might be a way to use it as the source so as not to have to muck with multiple lists

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" }

Know which modules are loaded on an Apache server
This let you know which modules has loaded the Apache server, very useful to know if the mod_rewrite is ready to use.

Get current logged in users shortname

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.


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: