Unix Interview Tips

Unix command to List files by date in Unix
ls -l | grep “12 Jul”

Unix command to remove blank line in a file
grep -v “^$” filename > newfilename
cat filename grep -v “^$”

Unix command to list lines with a range
Eg: list line from 5 -10 in string.txt
head 10 string.txt | tail -5

Empty file contents without changing inode information
cp /dev/null filename

How to change the timestamp of file/directory to Existing time
touch filename

How to Change timestamp of file/directory to the request time
Example : Modify the file timestamp to  may 10 10:24

Modify ur file, then give the following command
touch -t 200805101024 filename

Ways to create Empty file in Unix
touch filename
cat >filename
>filename

Related posts:

  1. Unix/Solaris commands to list folders and subfolders
  2. Summary of Unix VI Commands

Comments are closed.