It’s well known that console text editors promote a working style that promote you doing lots of things deterministically in constant time. For this reason it is necessary to know some basic commands of Linux.
For finding present work directory the command is >pwd . When it returns “/root” it means we are in top most directory “root”.
For changing the directory from one to other command >cd is used followed with /directory_name . When only >cd is given as command, it will bring back the pwd to /root.
To list the contents of a directory list or command >ls is used.
Linux allows to amend its command by using the dash(-) which are called switches.
For ls command, two basic switches are used:
>ls -a : It shows all files even with hidden attributes.
>ls -l : It gives full info like permissions,size,owner in a long list.
We use command >touch file_name to create a file (in default a text file) and command >mkdir directory_name to create a new directory. Again, to check the existence of newly created file or folder command >ls can be used.
Just like command >help in cmd on Windows, we have command >man for Linux to get help. It gives manual to nearly every command. For instance command >man ls. Command >ls –help can also be used for the process.
After able to create file and directory, following are the basic commands for managing these :
>cp file_name /from_location /to_location : Copy the file .
>mv file_name_in_pwd /to_location : Moving file.
>mv file_name_old file_name_new : That’s a tricky command to rename a file.
>cat file_name : To view file on terminal.
>more file_name : To view first page and wait for next signal , if Enter pressed next line will be shown and when SpaceBar is pressed next page is shown.
>less file_name : can be used to browse the contents of the specified file. Scroll half a screen page up or down with PgUp and PgDn or a full screen page down with Space. Jump to the beginning or end of a file using Home and End.
Pipe (|) allows Linux to combine the actions of several commands into one. eg. >command1 | command2 | command3 .