Most of us are very addicted to Microsoft Windows Operating System. But we have many more options to explore. The best part of using other operating systems are that you can learn many new features apart from staying in one platform and getting bored. According to me when  you explore new things, you learn many new things. The area of development widens.

Source: www.blograzzi.net

Today, I am writing this blog for all the starters who are still thinking UNIX/LINUX is not their cup of tea. But you need to understand that staying on Microsoft products makes you addicted to that it and dependant to very limited technology. Many softwares support multi OS(operating system) and many of them do not support all the OS. So we shall opt new things than staying limited access to our tech lives.

So I would like to share few basic commands which will be beneficial for you. Though you get the GUI(Graphical user Interface) for Unix and Linux, but it is a good practice to start commands with the Terminal window. Terminal window is same as the command prompt in Microsoft OS, but this Terminal prompt has more option to play with. Microsoft always limits its services, which makes users like me love the things Open Source way.

Directory Commands

$ pwd – this is often used check the present working directory.
$ mkdir dir – Make a directory dir
$ rmdir dir – remove a directory dir
$ cd dir – change directory to dir
$ ls – list files
$ ls -lt – gives the details of files, directory and links.
$ cd / – brings you directly to the root folder.

Bash Commands

$ uname – shows system and kernel information
$ mount – show mounted file system
$ date – shows date
$ cal – displays calendar
$ whoami – displays logged in username
$ man command – is the help command, which shows the manual for command typed.

File Operations

$ touch filename – to create a file.
$ cat filename – to view and concat the file.
$ more filename – can add filter on paging of the file.
$ file filename – get the type of file like a text or ascii
$ cp file1 file2 – will copy the content from file1 to file2
$ cp source target – copy the file to specified path.
$ mv file new_filename – Rename a file.
$ mv -i source target – gives an interactive prompt of yes or no while moving the files.
$ rm filename – deletes that file.
$ head filename – shows first 10 lines of the file.
$ tail filename – shows last 10 lines of the file.

ls Options

$ ls -a – shows all files including hidden files.
$ ls -R – recursive list
$ ls -r – shows reverse order of files.
$ ls -t – sorting the files by last modified.
$ ls -s – sorts files according to filesize.
$ ls -lt – shows a detailed information about the files and directories.

Searching Options

$ grep -i – searches for both upper and lower case.
$ grep -l -list the names of files with matching lines.
$ grep -c – counts the line that contains the pattern.
$ grep -v – inverts the search to display lines that do not match the pattern.
$ find /dir/ -username – finds files owned by that user name in dir
$ find /dir/ -mmin num – finds files modified less than number of minutes ago in dir

File Permission Numbers

Calculate permissions by adding the values of the permis­sions as mentioned below.

4 – read (r)
2 – write (w)
1 – execute (x)

Source: http://wiki.liway.info

Eg:

Octal Modes

| Permissions

644

rw- r– r–

751

rwx r-x –x

775

rwx rwx r-x

777

rwx rwx rwx

Octal digits for permissions.

Octal Value

| Permission Set

7

r w x

6

r w –

5

r – x

4

r – –

3

– w x

2

– w –

1

– – x

0

– – –

File Permissions

$ umask – checks for the stored value
$ chmod 775 filename – changes the accessing mode of the file to 775.
$ chmod -r filename – retrieves the read permission from filename.
$ chmod +x filename – grants execute permission to filename.
$ chmod u+x, go+r filename – grants execute permission to Owner of the file, and grants read permission to Group and Others.

Process Management

$ ps – shows the snapshot of the ongoing process.
$ kill pid – Kill process with that particular process ID
$ pkill name – Kill process with the name.

If you like this blog please follow me on Twitter @buggingweb, like the Facebook page and add us in your Google Profile.