Tuesday, May 27, 2008

Basic Unix Commands

Some commands were practiced in the lab. So since this is just for future brush up during interviews it will have only extra features, basic features I have to try and remember.

Very effective:
  • chmod - changes permission for directories/files. eg: chmod ugo+r+w+x filename - gives u-user,g-group,o-others the permission to read(r),write(w) and execute(x). For directory, execute permission is required.
  • ls - list files in the directory. The options most commonly used are -l which is to print file list with permissions, time modified, user details and the other option -a prints all files including the . and .. directories.
  • ff - find files. This command is used to search for a file throughout all available directories.
  • diff - The command which is really unique to unix. This command compares the two files and prints the differences with line numbers.
  • | - pipe. This allows commands to be combined.
Very Basic:
  • cp - copy command. This copies file from one location/one name to other location/another name.
  • mv - move command. This moves/changes file location or name respectively. One had to be careful, 'cause this results in deletion of the original file.
  • cd - change directory. When typed with no argument, it takes to home directory.
  • pwd - current working directory.
  • wc - word count. The order is lines,words and characters.
  • gzip & gunzip - compression/decompression of files.
  • finger - cmd to print details about user. Finger protocol (network).
  • telnet, ftp, rlogin - used for connecting to outer hosts.
  • kill - kills process forcibly
  • ps - lists the process run by you.
  • du - prints disk usuage.

No comments: