looks for IPs at the beginning of the line or prefixed by a space
Renames all files in the following format xxxxxx - 34. yyyyy.mp4 to the following format xxxxxx S1E34 - yyyyy.mp4
Piping a repeated character through the command will result in a single character only if there are more than 4 of them e.g. echo "aaaaaa bbbbb cccc ddd" | sed -ru 's/(.)\1{4,}/\1/g' the output will be "a b cccc ddd" Show Sample Output
You can use \n in your inserted data to insert multiple lines. The leading number is the position in the file where you want the insert, so in this case a '1' indicates the top of the file.
for redhat systems works sometimes :S tested on dell poweredge r7+ systems
In a multiple PostgreSQL server environment knowing the servers version can be important. Note that psql --version returns just the local psql apps version which may not be what you want. This command dumps the PostgreSQL servers version out to one line. You may need to add more command line options to the psql command for your connection environment. Show Sample Output
Filter out lines of input that contain 72, or fewer, characters. "sed -n" : don't print lines by default "/^.\{73,\}/" : find lines that start with 73 (or more) characters "p" : print them Show Sample Output
The sed script ensures that the "random" MAC address is unicast (bit 0 of first byte == 0) and local (bit 1 of first byte == 1)
If we've many files containing (?, ?, ?, ?, ? ) characters instead of ?, ?,... etc,... we can ue this simple command line running a sed command inside a for loop searching for files containing that characters. Hope u like it! Enjoy! ;) Show Sample Output
Convert all .weblock files (Apple url) to a url on the stdout.
Works even with spaces in filenames. As an alias in .gitconfig: [alias] editchanged = "!git status --porcelain | sed -ne 's/^ M //p' | tr '\\n' '\\0' | tr -d '\"' | xargs -0 vim"
Search, find and list aliases that match a regexp.
# basic search example:
alls c.*
# loose search example:
alls .*sudo.*
# remember to double escape special characters; example:
alls .*\\/.*
Regular expression search pattern to remove the Datetime and Name when you paste from skype chat into your text editor From this Gist: https://gist.github.com/webstandardcss/3967760857d6be470dda
Quickly reboot directly to Windows (or any other operating system) without the need to enter BIOS/UEFI or boot loader (if any). It's valid for one boot only, no persistent changes to boot priorities.
Something I do a lot is extract columns from some input where cut is not suitable because the columns are separated by not a single character but multiple spaces or tabs. So I often do things like: ... | awk '{print $7, $8}' ... which is a lot of typing, additionally slowed down when typing symbols like '{}$ ... Using the simple one-line function above makes it easier and faster: ... | col 7 8 How it works: The one-liner defines a new function with name col The function will execute awk, and it expects standard input (coming from a pipe or input redirection) The function arguments are processed with sed to use them with awk: replace all spaces with ,$ so that for example 1 2 3 becomes 1,$2,$3, which is inserted into the awk command to become the well formatted shell command: awk '{print $1,$2,$3}' Allows negative indexes to extract columns relative to the end of the line. Credit: http://www.bashoneliners.com/oneliners/oneliner/144/ Show Sample Output
When you run a lot of containers the built in docker ps output becomes unreadable. This command formats the output to be easier on the eyes. Requires q (https://github.com/harelba/q) text as data. Show Sample Output
Mac OSX friendly version of google function Show Sample Output
Using the $PIPESTATUS array you can get the results of a command in a sequence of commands piped together. The command above returns the result of grep -o "bob", which is exit result of 1 since no match was made. Show Sample Output
Not better, but more lightweight (sed instead of perl).
Above command is reduced due to length restriction of less than 256 characters and entity encoding of "Save" command on this page. This is complete command (best without entity encoding):
echo -e '\x2Helo folks\t!\r' | sed "y/\x0\x1\x2\x3\x4\x5\x6\x7\x8\x9\xA\xB\xC\xD\xE\xF\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1A\x1B\x1C\x1D\x1E\x1F\x20/␀␁␂␃␄␅␆␇␈␉␊␋␌␍␎␏␐␑␒␓␔␕␖␗␘␙␚␛␜␝␞␟␠/"
␂Helo␠folks␉!␍
Show Sample Output
btrfs checksum errors console report. 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: