Replace ^M with linefeeds
tr '\r' '\n' < foo > bar
awk '{ gsub("\r", "\n"); print $0;}' foo > bar
perl -p -e 's/\r/\n/g' < foo > bar
:%s/^M//g
^M
hold the control key, press V then M (Both while holding the control key) and the
^M
will appear. This will find all occurances and replace them with nothing.
Batch rename files
find . -name "*.htm" -exec rename {} html \;
turn off console beep in Linux
echo -e "\e[11;0]"
make directories executable
find www -type d -exec chmod go+x {} \;
tcpdump syntax to display data decode on the console
tcpdump -s 1518 -lenx -i eth0 |tcpshow -cooked -data
ls usage
ls -F
will add ASCII-characeter information after each filename to show file type: * (executable file), / (directory), = (socket), @ (symbolic link), or | (pipe)
ls -C
will force a listing to be displayed in multiple columns, even if you're piping the output into a pager like more or less.
ls -S
will sort files by size
ls -Sr
will do the same thing, only in reverse order
ls --ignore='[0-9]*'
will list only those filenames that do not begin with a digit
ls -v
knows how to deal with files containing version numbers
mount iso image loopback
mount -t iso9660 -oloop <image file> <directory>