Tip #193 Make multiple files or directories
Save time when making multiple files or directories (or performing any command requiring a list) where the file names only slightly differ.Read more »
- TAGS:
- mkdir
Tip #190 dos2unix all files in a directory
dos2unix requires the name of an input and output file so it can be hard to run on a list of files. The following gets around this and will run dos2unix on all files in a directory:Read more »
- TAGS:
- find
Tip #189 Remove every file but one
It's easy to remove (or copy, move etc.) all files that match a given criteria, but harder to move all but ones excluded by a criteria.To do this we can combine grep's -v option with Unix command substitution:
Read more »
Tip #187 View non-printing characters with cat
You can view unprintable and non ASCII characters in a file with 'cat -v -t -e'Example:
Read more »
- TAGS:
- cat
Tip #186 Using comm
You can use diff to see the differences between two files, but it can be useful to see what is the same and more clearly how they differ. This is where comm comes in useful.comm tells you what information is common to two lists and what information appears uniquely in one or the other.
Read more »
Tip #185 CDPATH
This is a little known and very underrated shell variable. CDPATH does for the cd built-in what PATH does for executables. By setting this wisely, you can cut down on the number of key-strokes you enter per day.For example:
Read more »
- TAGS:
- bash
Tip #183 Always running
This checks if a daemon is running, if not it starts the daemon. Great for daemons that need to always be running. Can be used with cronps -C someprogram || { someprogram & }
// sil at infiltrated dot net Read more »
- TAGS:
- ps
Tip #182 MAC address conversion
Convert mac addresses such as 000000abde00 into 00:00:00:ab:de:00awk '{for(i=10;i>=2;i-=2)$0=substr($0,1,i)":"substr($0,i+1);print}' macaddress_list
sed 's/\(..\)/\1:/g;s/:$//' macaddress_list
// sil at infiltrated.net
Read more »
alias aptitude at awk bash bc cal cat cd colrm comm cp csh curl cut date dd df dialog diff dirname dpkg du fc find fuser grep gs gzip history iconv kill ksh last less ln ls lsof lynx m4 md5sum mkdir mkfifo mkisofs mv mysql nc netstat openssl OSX perl ping popd ps pushd python read redirection rm scp screen sed sort ssh stat sudo svn tail tar tee test top tr uniq vim wc wget xargs