Unix commands
Basic commands to start with UNIX
To begin, lets first know why unix is used, unix is a portability, multi-tasking and multi-user capabilities in a time-sharing configuration. Unix systems are characterized by various concepts: the use of plain text for storing data; a hierarchical file system; treating devices and certain types of inter-process communication (IPC) as files; and the use of a large number of software tools, small programs that can be strung together through a command-line interpreter using pipes, as opposed to using a single monolithic program that includes all of the same functionality.
First lets see the 5 mostly used commands:
- cat
Cat command is used to concatenate the content present in the file. First, we go the directory where the required file is present and then we open the file to read it, now we can change the statements in the file i.e., we can rewrite the file.
2.cd
Cd referes to ‘change directory’ in various OS, i.e. if we are in bash and we want to go to some directory say documents to access the file in that directory or to create a file in the directory documents then to move from bash to the directory documents you have to use the command cd.
3.cp
Cp refers to copy, i.e. if you want to copy and file and store it with other name or same name we use cp command.
4.chmod
In this chmod refers to change mode i.e. we have 3 modes user, group, anyone and there are 3 numerical codes for read, write and execute where the ones place represent anyone, tens place represent group, hundreds place represents users. By numerical code 1 is to execute, 2 is to write, 4 is to read.
5.df
df displays the amount of disk space available on the file system containing each file name. If no file name is given, the space available on all current file systems is shown.
Here, are few more commands that are useful:
- less
Less command reads the contents in the file and its fast as it reads the content page by page not like any test editor which reads the file at once.
2.ls
Ls command refers to ‘list’, i.e. It shows all files or directories which are in the present directory.
3.mkdir
Mkdir refers to ‘make directory’, i.e. it creates the directory in the present directory. For example in the blow code I have created a directory in the bash so, it appears in the home section.
4.more
More command is to view all the content in the specified file all at a time which is entire screen at a time.
5.mv
Mv refers to ‘move’, i.e. it moves the file to another file and keeps the content in the file safe. While moving we can create a new file or we can move it into existing file and also eliminates the file which has been moved.
6.pwd
Pwd refers to ‘present working directory’, i.e. it returns the address of the current directory.
7.rmdir
Rmdir refers to ‘remove directory’, i.e. as the name suggests ir removes the directory from the current directory.
8.rm
It removes the files from the current directory (The file gets deleted).
9.man
man command is used to display the user manual of any command that we can run on the terminal.
10.uname
Uname command is used to display the basic information about the operating system and hardware.
11.who
Who command is used to get information about currently logged in user on to system.
12.ps
Ps refers to ‘process status’, i.e. it display or view information related to the
processes running in a system
13.vi
Vi stands for visual editor it shows the contents in the file.
14.cal
Cal command refers to calander, i.e. it shows the calander.
15.date
Date command as the name suggests shows the present date.
16.echo
echo command is used to display line of text that are passed as an argument.
17.bc
Bc refers to basic calculator, i.e it does basic mathematical operations that a simple calculator can do.
Ex: addtion, subtraction, multiplication, division etc..
18.grep
Grep is used to search a word or say string from a file. It can also perform may operations such as counting the string etc.
To learn more command refer to the website : https://www.tutorialspoint.com/unix/unix-useful-commands.htm