Linus Tips
Date Command
Touching files
Try the following command to see what it does!
touch {x,y}{x,y}{x,y}
Kill all zombie processes
ps -ef | grep "defunct" | cut -f1 | xargs kill
xargs is used to pass every line as argument to the command following it
Count number of files (and directories) in working directory.
ls | wc -l
Useful ls
ls -t
list files in reverse order of the modification time
ls -lat
all files and full listing; can be piped to more or less if list is big
ls -i
see inodes
ls --color
gives colored listing. You can alias ls for 'ls --color' in your .bashrc (or some other like .cshrc) file in the following way.
alias ls='ls --color'
aliases
cp='cp -i'
ls='ls --color'
Removing duplicate lines from a file
sort filename1 | uniq > filename2
Sort and remove duplicate lines from filename1 and create filename2
Refering to dictionary
look word
word can be initial letters of the word(s) you are looking for
look extra shows all the words starting with extra
Cut Command - Following is an example of how cut command can be used.
If you have a data-file with "|" as the separator, you can output only
some of the fields with this command.
cut -d "|" -f1,4,5 filename
This will output only the first, fourth and the fifth fields from the
file. -d option is used to specify the delimiter.
rename command
If you have files with extension .JPG and you want to change it to
lowercase .jpg.
rename .JPG .jpg *.JPG
Lynx traversal creates .dat files starting with lnk. If you want to
rename all these file so that all start with some other letters you can
do it with rename.
rename lnk abcd *.dat