Friday 20 December 2013

Unix questions and answers.

1. creating zero lenght file.
$cat /dev/null >file.txt

2. to find teh file size greater than 1000bytes.
$find ./ -size +1000

3. switching a shell
csh -s /bin/csh

4. adding user in linux.
$useradd -d /root/user1 -g owner -s /usr/bin/csh -m user1
$passwd user1

5. delete user in linux.
$userdel -r username

6. check the network status.
$netstat -ef | grep 2000

7. to configure the network status.
$ifconfig

8. display al running jobs.
$top

9. bring job to the foreground
$fg %jobnumber

10. bring the job to background.
$bg %jobnumber.

12. convertin file from dos to unix.
$dos2unix filename

13. split command
$split -option sourcedfile destinationfile
         - b bytes
         - l number of lines

14. deleting empty lines.

$sed '/s/^$/d' inputfile >outputfilee

15. creating symbolic link.
$ln -s file link

16. locate all instnce of the file.
locate file

17. to check disk space.
$df -options
        -k  kilobytes
        -m meghabytes
        h human readable

18. to get all teh links.
$ls -lrt | grep"^l"

19. display the output to multiple files.
$data | tee file1 file2

No comments:

Post a Comment