Everyone who uses a computer must be aware of the operating system as it’s a mandatory software which makes it possible to interact with hardware devices. In the contemporary period, we have several operating systems but only a few are popular and used very frequently. The operating system can be either GUI based or CLI based depending on how it facilitates the user’s interaction. Here in this lesson, we will be learning about UNIX which is very famous among users due to its some unique feature. So let’s get started!
What is Unix?
Unix is as an operating system which offers both the GUI and CLI based interaction. It is developed in C language by Dennis Ritchie. Unix is a multitasking operating system that also provides an opportunity for multiple users to utilize its feature. In simple terms, it’s also a multiuser operating system. Ubuntu operating system is a version of Unix which let us do all the work that Unix is supposed to do.
Though it is preferred by professionals who work with servers and all, it is also preferred when it comes to learning how a command line based OS works. There are several complex and large applications that use Unix to run due to its feature to manage the processes in an easy manner. When compared with the Windows OS, it is a bit fast and offers good user experience as well.
Unix provides the commands that are used while the user has to interact with the application using the command line interface. Unix Commands actually instruct the OS about what action has to be performed. Below are some Unix commands.
1. Ls command
This Unix command is used to show all the files and folders at your current location. The current location could be seen in the blue text that is just previous to the dollar sign. Here the current location is Desktop.
2. Clear Command
This command is used to clear the screen. It doesn’t delete anything written on the screen but just makes the current line to look like it is the first line. In the below picture shows the before and after images while using clear command.
4.6 (3,144 ratings)
3. Mkdir command
This Unix command is used to make a new directory at your current location. In the below image we are at the Desktop and using the mkdir command to create a directory named “newdir” there. The directory could be witnesses in blue color.
4. Rmdir command
This command will be used to remove the directory. In the below image you can see that in the second line, the newdir is present, but after we executed the rmdir command, it has deleted the newdir folder.
5. Cat command
Cat command is used to read the data written on any file. It could also be used to append the data in the file and can overwrite on it. We have seen that in the desktop location we have a file names test.css. We will see what is written on that file using cat command.
6. Vi Command
Vi command is the most useful command that is used to fetch the data written on any file on the terminal and also let us make the changes at the same time. Regardless of the size and type of the file, we can edit those using the Vi command if they have text written on it. Here we will add extra data in the test.css file.
7. Rm command
The rm command is used to delete the files at your current location. In our case, we are at Desktop that has the test.css file, Now we will try to delete that file using the rm command. In the second line, it shows test.css present there but after running rm command, that file has been removed
8. Mv command
The mv command can be used for two purposes, for renaming and for moving file or folder. Here we will rename the page.html file to newpage.html. Please note that if you will try to move the file in the same folder, it will rename it and if you will try to move it to another directory, it will get moved there.
9. Su command
Su command is used when we need to switch the user. In the below picture, we will be able to see that the current user is Vishal and after we used the su command to login as root, the user name will be changed. The user name can be seen in the red text on the left side of the dollar mark.
10. Chmod command
The chmod command is used when we have to change the permission of any file. Here we have the newpage.html file. The file has read and run permission to the owner, read permission to the group and read permission to others. We will use the chmod command to give all permission to everyone.
11. Sudo command
There are some commands that the only root is authorized to execute. Here we will be executing a command that could lead to making some changes in the system and hence it couldn’t be executed with other users. We have to use Sudo command to make it work.
Tips and Tricks to Use Unix command
In the above sections, we went through the simple commands to some sophisticated commands. Though the commands are very less in the count, it could be used with several arguments to perform some of the complex tasks. For instance, the ls command can be used to check which file and directories are available at your current location but it could be used as -an argument to uncover all the hidden files at the same location.
Every command has some of the argument allocated to it that could be used on with those particular commands. In order to check which arguments are there for any specific command you can use –help the argument. In the below image, we will see all the arguments that could be used with chmod command. The keywords or arguments have to be followed by — while writing in the command line.
Conclusion – Unix Commands
Unix is an operating system popular for its command line interface. It is comprised of numerous commands that facilitate users interaction with the hardware. The command in Unix is actually the mean of communication while working through the terminal. In addition to CLI, it also offers the graphical user interface that adds more beauty to the pre-existing features of Unix.
This has been a guide to Unix Commands. Here we discussed Unix Commands with the help of examples and some tips and tricks. You can also go through our other suggested articles to learn more –