I wanted a method to display the last run of my script from my log file. I had a pattern I could grep for to find the beginning of each run. This command line greps for that pattern in the log, finds the last occurrence and gives me the line number. Then I use the line number in tail to give me everything from that line number to the end of the log file. I tested this on Linux Mint (variant of Ubuntu) and on RHEL, but I suspect it will run many Linux systems.
Use dpkg-query to query packages.
Extracts the binary from the .text section and escapes it. This puts it in a form ready to use in a program. Show Sample Output
Combs through your home directory and destroys all Vagrant boxes.
Used $(pwd) to get full path find to list files xargs to pass args bash to parse variables
Diff 2 branches, for a type of file & having a string in the diff
-name : base of filename -o : 'or' '*.c' : avoiding "paths must precede expression" error message -type f : only find file type --color: hightlight specific word with color -E : extended regexp Show Sample Output
Stat -c %n #list files. A find command is also useful Tee #use stdout, but reseend to next comand. Can be other Tee ad infinitum xargs #use de name of files to execute md5 and sha diggest.
This version handles directory names with spaces properly
We had a number of git tags named similarly to: 2016.12.13.devel.feature 2016.12.14.master.release But we have multiple developers making commits and tags for testing purposes. I wanted to reduce the number of tags that displayed on our cloud hosting server when doing a deployment.
Show the executable that spawned the process and show the PID and ORACLE_HOME relative to the environment within which the process is running.
Converts all the png files in a directory to a bunch of gifs - changing only the file extension. Converts them in parallel - simply change the '4' to match the number of CPUs you have, or the number you want to dedicate to the conversion process.
Taken from: https://unix.stackexchange.com/questions/129159/record-every-keystroke-and-store-in-a-file Author: Stephane Chazelas Show Sample Output
Saves a step between which'ing to find out the full path of a script, then copy and pasting, and less'ing the full path.
It works extremely fast, because it calculates md5sum only on the files that have the same size and name. But there is nothing for free - it won't find duplicates with the different names. Show Sample Output
Use find . -iname "*.py" -type f -print0 | xargs -0 sed -ne 's/^\([ \t]*\)print \(.*\)$/\1print(\2)/p' to see what would be changed.
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: