Commands by pascalv (10)

  • Lower PowerShell priority, so that to launch processes in the background and work normally with other applications Show Sample Output

    PS C:\Users\pascalv> Get-WmiObject Win32_process -filter 'name = "powershell.exe"' | Foreach-Object { $_.SetPriority(16384) }
    pascalv · 2022-06-16 14:53:28 203
  • Directly download all mp3 files of the desired podcast

    curl | grep -Eo "(http|https)://[a-zA-Z0-9./?=_%:-]*mp3" | sort -u | xargs wget
    pascalv · 2021-08-09 13:40:26 103

  • 1
    & 'C:\cwRsync_5.5.0_x86_Free\bin\rsync.exe' --force --ignore-errors --no-perms --chmod=ugo=rwX --checksum --delete --backup --backup-dir="_EVAC/$(Get-Date -Format "yyyy-MM-dd-HH-mm-ss")" --whole-file -a -v "//MyServer/MyFolder" "/cygdrive/c/Backup"
    pascalv · 2020-03-06 10:17:42 47
  • Apart from an exact copy of your recent contents, also keep all earlier versions of files and folders that were modified or deleted. Inspired by EVACopy Show Sample Output

    backup() { source=$1 ; rsync --relative --force --ignore-errors --no-perms --chmod=ugo=rwX --delete --backup --backup-dir=$(date +%Y%m%d-%H%M%S)_Backup --whole-file -a -v $source/ ~/Backup ; } ; backup /source_folder_to_backup
    pascalv · 2018-08-02 21:27:29 55
  • This takes a picture (with the web cam) every 5 minutes, and send the picture to your e-mail. Some systems support mail -a "References: " so that all video surveillance emails are grouped in a single email thread. To keep your inbox clean, it is still possible to filter and move to trash video surveillance emails (and restore these emails only if you really get robbed!) For instance with Gmail, emails sent to can be filtered with "Matches:" Show Sample Output

    while true ; do fswebcam -d /dev/video0 -r 1280x1024 -F 15 - | uuencode $(date +\%Y\%m\%d\%H\%M).jpeg | mail -s "Video surveillance" ; sleep 300 ; done
    pascalv · 2016-08-09 14:22:45 8
  • Access a random news web page on the internet. The Links browser can of course be replaced by Firefox or any modern graphical web browser.

    links $( a=( $( lynx -dump -listonly "" | grep -Eo "(http|https)://[a-zA-Z0-9./?=_-]*" | grep -v "" | sort | uniq ) ) ; amax=${#a[@]} ; n=$(( `date '+%s'` % $amax )) ; echo ${a[n]} )
    pascalv · 2016-07-26 11:52:12 43
  • (In French) Connection aux hotspots FreeWifi, et maintien de la connection active

    while true ; do wget --quiet --no-check-certificate --post-data 'login=my_account_number&password=my_password&submit=Valider' '' -O '/dev/null' ; sleep 600; done
    pascalv · 2016-07-23 16:34:42 9
  • Sweep and download all mp3 (in French) of "Rendez-vous avec X" (Meet with M. X) of French public radio From 1997 To 2015 Balaye et telecharge les episodes depuis 1997 jusqu'en 2015

    pascalv · 2015-08-13 21:34:50 7
  • Run "ps -x" (process status) in the background every hour (in this example). The outputs of both "nohup" and "ps -x" are sent to the e-mail (instead of nohup.out and stdout and stderr). If you like it, replace "ps -x" by the command of your choice, replace 3600 (1 hour) by the period of your choice. You can run the command in the loop any time by killing the sleep process. For example ps -x 2925 ? S 0:00.00 sh -c unzip >/dev/null 2>&1 11288 ? O 0:00.00 unzip 25428 ? I 0:00.00 sleep 3600 14346 pts/42- I 0:00.01 bash -c while true; do ps -x | mail pascalv; sleep 3600; done 643 pts/66 Ss 0:00.03 -bash 14124 pts/66 O+ 0:00.00 ps -x kill 25428 You have mail in /mail/pascalv Show Sample Output

    nohup bash -c "while true; do ps -x | mail; sleep 3600; done" | mail &
    pascalv · 2013-08-19 17:21:37 12
  • This will send the web page at $u to . To send the web page to oneself, can be replaced by $(whoami) . The "charset" is UTF-8 here, but any alternative charset of your choice would work. `wget -O - -o /dev/null $u` may be considered instead of `curl $u` . On some systems the complete path to sendmail may be necessary, for instance /sys/pkg/libexec/sendmail/sendmail for some NetBSD.

    { u=""; echo "Subject: $u"; echo "Mime-Version: 1.0"; echo -e "Content-Type: text/html; charset=utf-8\n\n"; curl $u ; } | sendmail
    pascalv · 2010-02-24 04:18:30 3

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

prints the parameter you used on the previous command

Apply an xdelta patch to a file
xdelta is a command line program for delta encoding, which generates the difference between two files. This is similar to diff and patch, but it is targeted for binary files and does not generate human readable output.

Add the time to BASH prompt
Adds the time in 12hr AM/PM format to the beginning of a prompt. Change \@ to \t for 24-hour time or \T for 12hr without AM/PM. To keep the time the next time you open a terminal, edit ~/.bashrc and stick the command at the bottom.

Summary of disk usage, excluding other filesystems, summarised and sorted by size
This command is useful for finding out which directories below the current location use the most space. It is summarised by directory and excludes mounted filesystems. Finally it is sorted by size.

Find the package a command belongs to on debian-based distros

Find usb device in realtime
Using this command you can track a moment when usb device was attached.

put all lines in comment where de word DEBUG is found

Make a playlistfile for mpg321 or other CLI player
Supports other file formats.

sends your internal IP by email
This is useful if you have need to do port forwarding and your router doesn't assign static IPs, you can add it to a script in a cron job that checks if you IP as recently changed or with a trigger script. This was tested on Mac OSX.

Download all music files off of a website using wget
This will download all files of the type specified after "-A" from a website. Here is a breakdown of the options: -r turns on recursion and downloads all links on page -l1 goes only one level of links into the page(this is really important when using -r) -H spans domains meaning it will download links to sites that don't have the same domain -nd means put all the downloads in the current directory instead of making all the directories in the path -A mp3 filters to only download links that are mp3s(this can be a comma separated list of different file formats to search for multiple types) -e robots=off just means to ignore the robots.txt file which stops programs like wget from crashing the site... sorry http://example/url lol..

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: