Compare the content of the files in the current directory with files of the same name in the duplicate directory.
Pop Quiz: You have a duplicate of a directory with files of the same name that might differ. What do you do?
You could use diff to compare the directories, but that's boring and it isn't as clever as find -print0 with xargs.
Note: You must omit stderr redirect 2>/dev/null to see the list of missing files from DUPDIR, if any.
Hint: Redirect stderr to a new file to produce a more readable list of files that are missing from DUPDIR.
Warning: This doesn't tell you if DUPDIR contains files not found in the current directory so don't delete DUPDIR.
Show Sample Output
Removed grep and simplified if statement. -- Friday is the 5th day of the week, monday is the 1st. Output may be affected by locale. Show Sample Output
Use this function with bash version 4+ to convert arbitrary hexadecimal sequences to binary. If you don't have bash 4+ then modify the lowercase to uppercase demangling statement
s=${@^^}
to set s equal to the uppercase hex input or the bc command throws an input parser error.
Show Sample Output
install json-to-js as a npm global package
It tries to identify the file types in a directory and adds or replaces them with their appropriate extensions. Please, update the "file" tool before use it (last version: 5.37): https://github.com/file/file
WRT the original solution: 1. I might be wrong, but it seems DocumentRoot (per Apache docs) should be spelled exactly as is, as it is case-sensitive. So using -i will return strings such as documentroot, DOCUMENTROOT,.... (which could been added as part of a comment) 2. It returns false results for such cases as DocumentRoot is embedded in a comment 3. It returns false results for such cases as OldDocumentRoot, DocumentRoot.sav, ... in a comment. Other notes: - FYI: There might be more than one valid DocumentRoot entry in the conf file (in case of using virtual host(s))
No need to fork off a process.
to test check if given variable is a digit / number Show Sample Output
The sample output is from an Android Device Show Sample Output
This version won't reconnect if you exit the ssh connection with a non-zero exit code. ConnectTimeout and sleep values knobs for how long to wait for each retry.
Check out Gate number for your flight from CLI with Chrome, html2texgt and grep. Works on Arch Linux (Garuda) and probably will work on others. Requirements: * google chrome (might work with chromium as well) * installed html2text (on archlinux: sudo pacman -S python-html2text) * installed grep (comes by default with your OS) * the gate number should be visible at the given website (it's not existent too early before the flight and also disappears after the flight departed) Please don't forget to replace the link to appropriate one, matching your flight. You can also wrap this into something like `whlie true; do ...; sleep 60; done' and this will check and tell you the gate number maximum in 1 minute after it appears on Avinor website. Show Sample Output
This one-liner outputs a random number between the values given for FLOOR and RANGE. Show Sample Output
NOT MINE! Taken from hackzine.com blog. It creates a tree-style output of all the (sub)folders and (sub)files from the current folder and down(deeper) Quoting some of hackzine's words "Murphy Mac sent us a link to a handy find/sed command that simulates the DOS tree command that you might be missing on your Mac or Linux box. [..split...] Like most things I've seen sed do, it does quite a bit in a single line of code and is completely impossible to read. Sure it's just a couple of substitutions, but like a jack in the box, it remains a surprise every time I run it." Show Sample Output
With this command you can use shell variables inside sed scripts. This is useful if the script MUST remain in an external file, otherwise you can simply use an inline -e argument to sed.
Every seconds do Show Sample Output
search argument in PATH accept grep expressions without args, list all binaries found in PATH Show Sample Output
Bash 4 will let you do {00..19} to get leading zeros, but Bash 3 doesn't have that feature. This technique gets you partway there (the sequences need be such that the last digit ranges from zero to nine - you can't use this for something like Bash 4's {03..27}, for example). When this limitation is not a problem, you can avoid some complicated string manipulation for concatenating leading zeros.
You can add more digits like this: {0..1}{0..9}{0..9} (ranges from 0 to 99 with up to two leading zeros). To pad with additional zeros:
for i in 000{0..1}{0..9}; do echo $i; done
or
for i in {0..1}{0..9}; do echo "000$i"; done
This is useful for creating values to sort or for creating filenames with a fixed format. Note that this will also work:
touch {0..1}{0..9}
Show Sample Output
Can be used to discover what programms create internet traffic. Skip the part after awk to get more details. Has anyone an idea why the uniq doesn't work propperly here (see sample output)? Show Sample Output
Same thing just a different way to get there. You will need lynx
Hi glaudiston, you can save a few chars by leaving out cat and pipe and still enjoy the added flexibility.
Bash scrip to test if a server is up, you can use this before wget'ing a file to make sure a blank one isn't downloaded.
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: