EDUCBA

EDUCBA

MENUMENU
  • Blog
  • Free Courses
  • All Courses
  • All in One Bundle
  • Login
Home Software Development Software Development Tutorials Unix Tutorial Unix Commands

Unix Commands

Priya Pedamkar
Article byPriya Pedamkar

Updated July 11, 2023

Unix Commands

Introduction to Unix Commands

The following article provides an outline for Unix Commands. An operating system offering both Graphical User Interface (GUI) and Command Line Interface (CLI) based interaction developed by Dennis Ritchie, Ken Thompson, Brian Kernighan, Joe Ossanna, and Douglas Mcllroy at Bell laboratory in the year 1970 known as a multi-tasking operating system allowing multiple users to work on the operating system simultaneously and provides commands for the users to interact with the application through Command Line Interface (CLI) like ls command, clear command, mkdir command, rmdir command, cat command, vi commands, rm command, mv command, su command, chmod command, sudo command, etc. which can be used to perform complex tasks.

Start Your Free Software Development Course

Web development, programming languages, Software testing & others

What is Unix?

Unix is an operating system that offers both GUI and CLI-based interaction. Dennis Ritchie developed the C language. 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, which allows us to perform all the tasks traditionally associated with Unix, is a Unix-based version.

Professionals working with servers and individuals learning about command-line-based operating systems prefer it. Several complex and large applications use Unix to run due to its feature to manage the processes easily. Compared with the Windows OS, it is a bit fast and offers a good user experience.

1. Ls Command

This Unix command shows all the files and folders at your current location. The blue text just before the dollar sign indicates the current location or directory in the command-line interface. Here the current location is the Desktop.

Unix command Ls

2. Clear Command

The command used to clear the screen is “clear”. It doesn’t delete anything written on the screen but makes the current line look like the first line.

The below picture shows the before and after images while using the clear command.

Unix command Clear 1

Unix command Clear 2

3. Mkdir Command

This Unix command makes 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 is typically displayed in blue color.

Unix command Mkdir

4. Rmdir Command

The command used to remove a directory is “rmdir”. In the below image, you can see that in the second line, the newdir is present, but after we executed the rmdir command, it deleted the newdir folder.

Unix command Rmdir

5. Cat Command

Cat command is used to read the data written on any file. You can use the command to append data to a file and overwrite its contents as well. We have seen that we have a file names test.css in the desktop location. Let’s use the cat command to display the contents of the file.

Unix command Cat

6. Vi Command

Vi command is the most useful command used to fetch the data written on any file on the terminal and let us make the changes simultaneously. 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.

Vi

7. Rm Command

The rm command is used to delete the files at your current location. In our case, we are at the Desktop with the test.css file; Now, we will try to delete that file using the rm command. The second line shows test.css present there, but after running the rm command, that file has been removed.

Rm

8. Mv Command

The mv command can be used for two purposes, for renaming and for moving files or folders. Here we will rename the page.html file to newpage.html. Please note that if you try to move the file to the same folder, it will rename it; if you try to move it to another directory, it will get moved there.

Mv

9. Su Command

Su command is used when we need to switch the user. In the picture below, we can observe that the current user is Vishal. Once the “su” command is used to log in as the root user, the username will indeed change. The red text on the left side of the dollar sign displays the username.

Su

10. Chmod Command

We use the chmod command to change the permissions of a file. Here we have the newpage.html file. The file has read and run permission to the owner, the group, and others. We will use the chmod command to give all permission to everyone.

Chmod

11. Sudo Command

Only the root user has the authorization to execute certain commands. 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 the Sudo command to make it work.

Sudo

Tips and Tricks to Use Unix Commands

Despite the limited number of commands, they can be utilized with multiple arguments to accomplish complex tasks. For instance, you can use the ls command to check the available files and directories at your current location. Additionally, using the -an argument with ls can reveal all the hidden files at the same location.

Every command has some arguments allocated to it that could be used with those particular commands. To check which arguments are 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 the chmod command. The keywords or arguments must be followed by — while writing in the command line.

tips

Conclusion – Unix Commands

Unix is an operating system popular for its command-line interface. It comprises numerous commands that facilitate users’ interaction with the hardware. The command in Unix is the mean of communication while working through the terminal. In addition to CLI, it also offers a graphical user interface that adds more beauty to the pre-existing features of Unix.

Recommended Articles

We hope that this EDUCBA information on “Unix Commands” was beneficial to you. You can view EDUCBA’s recommended articles for more information.

  1. Find Command in Unix
  2. VI Command in Unix
  3. Paste Command in Unix
  4. Unix Shell Commands
All in One Excel VBA Bundle
500+ Hours of HD Videos
15 Learning Paths
120+ Courses
Verifiable Certificate of Completion
Lifetime Access
Financial Analyst Masters Training Program
2000+ Hours of HD Videos
43 Learning Paths
550+ Courses
Verifiable Certificate of Completion
Lifetime Access
All in One Data Science Bundle
2000+ Hour of HD Videos
80 Learning Paths
400+ Courses
Verifiable Certificate of Completion
Lifetime Access
All in One Software Development Bundle
5000+ Hours of HD Videos
149 Learning Paths
1050+ Courses
Verifiable Certificate of Completion
Lifetime Access
Primary Sidebar
All in One Software Development Bundle5000+ Hours of HD Videos | 149 Learning Paths | 1050+ Courses | Verifiable Certificate of Completion | Lifetime Access
Financial Analyst Masters Training Program2000+ Hours of HD Videos | 43 Learning Paths | 550+ Courses | Verifiable Certificate of Completion | Lifetime Access
Footer
About Us
  • Blog
  • Who is EDUCBA?
  • Sign Up
  • Live Classes
  • Certificate from Top Institutions
  • Contact Us
  • Verifiable Certificate
  • Reviews
  • Terms and Conditions
  • Privacy Policy
  •  
Apps
  • iPhone & iPad
  • Android
Resources
  • Free Courses
  • Java Tutorials
  • Python Tutorials
  • All Tutorials
Certification Courses
  • All Courses
  • Software Development Course - All in One Bundle
  • Become a Python Developer
  • Java Course
  • Become a Selenium Automation Tester
  • Become an IoT Developer
  • ASP.NET Course
  • VB.NET Course
  • PHP Course

ISO 10004:2018 & ISO 9001:2015 Certified

© 2023 - EDUCBA. ALL RIGHTS RESERVED. THE CERTIFICATION NAMES ARE THE TRADEMARKS OF THEIR RESPECTIVE OWNERS.

Let’s Get Started

By signing up, you agree to our Terms of Use and Privacy Policy.

EDUCBA

*Please provide your correct email id. Login details for this Free course will be emailed to you

EDUCBA
Free Software Development Course

Web development, programming languages, Software testing & others

By continuing above step, you agree to our Terms of Use and Privacy Policy.
*Please provide your correct email id. Login details for this Free course will be emailed to you

EDUCBA

*Please provide your correct email id. Login details for this Free course will be emailed to you
EDUCBA

*Please provide your correct email id. Login details for this Free course will be emailed to you
EDUCBA Login

Forgot Password?

By signing up, you agree to our Terms of Use and Privacy Policy.

This website or its third-party tools use cookies, which are necessary to its functioning and required to achieve the purposes illustrated in the cookie policy. By closing this banner, scrolling this page, clicking a link or continuing to browse otherwise, you agree to our Privacy Policy

Loading . . .
Quiz
Question:

Answer:

Quiz Result
Total QuestionsCorrect AnswersWrong AnswersPercentage

Explore 1000+ varieties of Mock tests View more