Introduction to Linux – Ubuntu Basic Commands

ubuntu

Hey everyone, Today we are going to learn about the Ubuntu basic commands, as we know the Linux-based operating system is the best due to its flexibility, open-source platform, portability, command-line interface, and compatibility with popular development tools.

So, we will discuss the most commonly useful commands which you should know if you are working on Linux-based O.S i.e. Ubuntu. Let’s start.



1. Breif about Ubuntu ubuntu_logo

Ubuntu can be considered as Linux based distribution system which is open source and entirely free in the common market. This is the most commonly used Linux flavor in the industry.

2. Linux Basic Commands

There are numerous commands that allow us to handle files/directories and deal with users.

Let us start with commands related to handling files and directories:-

Pwd

PWD stands for PRESENT WORKING DIRECTORY. This command is mainly used for displaying the specific directory where the command executer is currently belonged to.

Sometimes in the case of the Ubuntu Linux platform, users are unable to understand in which directory he is right now. Then PWD is the key command for understanding the same.

Now, as we have an idea of the present working directory, now we wish to switch the directory – For this Ubuntu has provided us with the below command…


Cd

CD stands for “Changing Directory”, and as per the naming convention, it helps us to change from the current working directory to the specified path.

Some points to be noted:-

  • cd.. (see the 2 dots) :- it helps us to bring one folder down, i.e. if pwd is Desktop/Linux then cd.. will bring you in Desktop directory.
  • cd ~ or  cd :- This will help us to bring to the root directory, i.e. pwd will become the root directory.

Ls

The Ls command in Linux is used to display a directory’s files and folders. This helps us to explore the directories.

ls-l

Touch

It helps us to create an empty file in the present directory.

touch
Single file
touch-m
For multiple files

Cat

It helps us to display the content of the file without opening the file.

cat

echo

The echo command in Linux simply displays a line of text/string which is passed in as an argument. It is commonly used for debugging shell programs inside the terminal.

If the string is containing the newline (\n) in it, then we can this command to show.

The ‘-e‘ tag enables the echo command to recognize the backslash escape sequences inside the argument.

echo

Rm

The rm command in Linux helps you delete files and directories. To be more specific, rm deletes all references to objects from the filesystem.

We can also use tags with this command. For example, if you want to request confirmation from the developer before deleting the corresponding file, then use the below command.

rm-i

Rmdir

The rmdir command in Linux only allows you to delete empty directories. So, if a directory has some files/folders inside it, rmdir will display an error.

rmdir

mv

mv helps users to perform below two functions:-

  • You can rename a file/directory using this command.
mv
  • We can easily move a file/directory from one location to another.

Cp

The cp command in Linux translates to ‘copy’. It is used to copy files/directories from one location to another from inside the terminal.

Let us assume we have two separate files ‘First.txt‘ and ‘Second.txt‘ inside our current working directory. Their contents are as follows:

First.txt
Second.txt

Now, if we use this command cp First.txt Second.txt will give the result:

cp

And here you go…now you will be able to see that the text from the First.txt file is being copied to Second.txt.


So, that’s all about the basic commands of Ubuntu, these are the most frequently used commands which every developer should know. We will also discuss the advanced commands of document handling in Linux based operating system. So stay connected with our latest posts.

Hope you like it👍 and if you find this useful then don’t forget to share this with your friends or on social media. And If you have any queries, please do ask in the comments section or anything that you want through mail then contact.

Thanks😉


Also, read

Share
[7] Advanced and Useful Linux – Ubuntu Commands How to revert or undo last commit in Git? Explain For, While, Do-While Loops in JS and more Setup AWS CLI on MAC, Windows, and Linux Introduction to Comparison and Logical Operators in JS Difference between AWS, AZURE, and GCP Cloud Conditional Statement in JS – with examples