Simply change the years listed in the first seq, and it will print out all the months in that span of years that have Friday the 13ths in them. Show Sample Output
Shorter version using --tag
Alter the years in the first brace expansion to select your year range. Modify date format to your liking but leave " %w" at the end. Show Sample Output
This snippet allows to process the output of any bash command line by line.
This command will find all occurrences of one or more patterns in a collection of files and will delete every line matching the patterns in every file
Rather than complicated and fragile paths relative to a script like "../../other", this command will retrieve the full path of the file's repository head. Safe with spaces in directory names. Works within a symlinked directory. Broken down:
cd "$(dirname "${BASH_SOURCE[0]}")"
temporarily changes directories within this expansion. Double quoted "$(dirname" and ")" with unquoted ${BASH_SOURCE[0]} allows spaces in the path.
git rev-parse --show-toplevel
gets the full path of the repository head of the current working directory, which was temporarily changed by the "cd".
Using perl in a one-liner is a bit overkill to randomly sort some input. `sort` from coreutils should be enough.
Output the current time in Swatch “Internet Time”, aka .beats. There are 1000 .beats in a day, and @0 is at 00:00 Central European Standard Time. This was briefly a thing in the late 1990s. More details:
https://2020.swatch.com/en_ca/internet-time/
The alias is rather quote heavy to protect the subshell, so the bare command is:
echo '@'$(TZ=GMT-1 date +'(%-S + %-M * 60 + %-H * 3600) / 86.4'|bc)
Show Sample Output
Directly download all mp3 files of the desired podcast
Thanks to this user: https://stackoverflow.com/a/35636373/2394635 Show Sample Output
The brace expansion also allows you to count backward: for i in {15..1}; do echo $i; done You can also use this construct to create new file or new directory: mkdir dir{1..3} # Same as mkdir dir1 dir2 dir3
The file .my.cnf located at user's home directory is used for mysql login. If this file exists, then
mysql -uYOURUSERNAME -pYOURPASSWORD database -e 'SOME SQL COMMAND'
can be replaced with
mysql database -e 'SOME SQL COMMAND'
It saves you from typing!
This is valid for mysqladmin and mysqldump commands as well.
Show Sample Output
Echos the number of seconds from the current time till the specified time (Example in command is (2**31-1)) aka the Unix epoch. Just replace that number with the specified date (in seconds past Jan. 1st 1970) and it will return the seconds. NOTE: Only works in bash Show Sample Output
This is a working version, though probably clumsy, of the script submitted by felix001. This works on ubuntu and CygWin. This would be great as a bash function, defined in .bashrc. Additionally it would work as a script put in the path. Show Sample Output
Generates a frequency sweep from $x to $y, with $d numbers inbetween each step, and with each tone lasting $l milliseconds. Show Sample Output
gemInst.sh: #!/bin/bash for i in $@; do if [ "$1" != "$i" ] then echo /newInstall/gem install $1 -v=\"$i\" /newInstall/gem install $1 -v="$i" if [ "$?" != "0" ] then echo -e "\n\nGEM INSTALL ERROR: $1\n\n" echo "$1" > gemInst.err fi fi done
Save the script as: sort_file Usage: sort_file < sort_me.csv > out_file.csv This script was originally posted by Admiral Beotch in LinuxQuestions.org on the Linux-Software forum. I modified this script to make it more portable. Show Sample Output
Create a bunch of random files with random binary content. Basically dd dumps randomly from your hard disk to files random-file*. Show Sample Output
"&&" runs sed if and only if the backup completed and /bin/cp exited cleanly. Works for multiple files; just specify multiple filenames (or glob). Use -v switch for cp to play it safe.
Uses 'seq' with formatting parameter to generate the necessary padded sequence. Change '%02.0f' to how many digits you need (for 3, use %03.0f, etc) and replace 5 & 15 with your desired min and max. Show Sample Output
emulates bash4's "echo {03..20}" Uses bash3 builtin function printf Show Sample Output
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.
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
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: