Tag Archives: bash

Finding files based on their modification date

To list any files in the current folder that have been modified today, you need to search for files that are less than one day old.

Posted in Linux | Tagged , | Leave a comment

Searching Files

The following (rather long) command will search all the specified files in the current folder for the matching text and display the file names and matching lines.

Posted in Linux | Tagged | Leave a comment

Find default network device

A quick one line command that returns the name of the default network device. $ echo $(ip route | sed -e “/^.*default.*/! d” -e “s/^.*dev.//” | cut -f 1 -d ‘ ‘) eth0 $ 

Posted in Linux | Tagged | Leave a comment

Kill a named task

It is probably something of an understatement to say that not all versions of UNIX are the same, however it can still be a bit of a surprise when a command you have got used to using simply doesn’t exist.

Posted in Linux, Tru64 UNIX | Tagged | Leave a comment

Look for differences in two columns

Most of the time when I want to select a field or filter the output from a command I can get by with simply using various combinations of ‘cut’ and ‘grep’, this time I wanted to compare two bit patterns … Continue reading

Posted in Linux | Tagged , | Leave a comment

How to iterate over all the files in a folder

The following commands allow you to iterate over all the files in a folder, and execute a command on each one.

Posted in Linux | Tagged | Leave a comment

Burning CDROM images

Burning CDROM images to a blank disc from the command line is probably simpler than you think, and most of the time it just works.

Posted in Linux | Tagged | Leave a comment

Obfuscating IP addresses

When posting stuff on line it is generally a good idea not to give away too much, so decided to see if could come up with a little python script that used a regular expression to remove any IP addresses … Continue reading

Posted in Linux | Tagged , | Leave a comment

Undoing a git-hub commit

Although I try to be careful there are occasions when I push a commit to git-hub only to discover I’ve forgotten to update the change history in the comments or check my spelling!

Posted in Linux, Programming | Tagged , | Leave a comment

Converting filenames to lowercase

A quick one liner that renames any files with uppercase characters in their filenames to lowercase $ ls | grep -v [a-z] | \ > while read -r name; do mv -v "$name" "`echo $name |tr '[A-Z]' '[a-z]'`"; done

Posted in Linux | Tagged | Leave a comment