December 3, 2024

Basic Linux Commands for Beginners

In this article, we will be talking about Linux basic commands that almost every one of us uses on their day to day tasks. So basically where this command should be run well you all know the word “Terminal” from where you can give any instruction to your Linux machine.

So basically how does the “Terminal” looks like we’ll see the image?

To open Terminal, press ctrl+Alt+t in Debian distribution like Ubuntu, or press alt+F2 in gnome terminal and press enter.

Basic Commands

ls This command is used to list the files and directory you are in, to see all hidden files use the command “ls -a”

cd – This command is used to go to the directory. For example, if you are in the home directory and wanted to go to a directory /var/www/html then just type the command cd /var/www/html. Remember that this command is case-sensitive and you will have to type the exact name of the folder/directory

mkdir & rmdir – The “mkdir” command is used to create a folder or directory. For example, if you want to create a directory called “vedant” then just type the command mkdir vedant and the directory/folder will be created. rmdir is used to remove/delete the directory/folder.

pwd – pwd stands for (present working directory). Basically, this command gives you the absolute path of the directory, which means the path that starts from the root

rm – This command is basically used to delete directories and files. rm -r is used to delete directory and rm -rf is used delete directory with force which means it won’t prompt the information it will directly delete the directory or files.

man – If you don’t have any information about the command and want to know the syntax of command just type man followed by the command it will show you the entire information about the command. For example, just type man cat and it will show you the entire information related to cat command.

cat – This command is basically used to display the contents of a file. It is basically used by the system administrators to view the programs.

nano, vi – In Linux system these two text editors are by default installed in your system. The nano command is a very good text editor because everything in the nano is colourfull, Whereas vi is simpler than nano. For example, if you want to edit a file just type nano or vi followed by the filename.

cp – This command is used to copy files through command line. It basically takes two arguments: First is the location of the file to copied and second is the location of the files where to be copied.

touch – This command is basically used to create a file.

sudo – sudo stand for “SuperUser” which means if you want to execute any administrative command with root privileges. For example if you want to write or edit some file file you will need the sudo provilege.

mv – This command is used to move the files through command line. This command can also be used to rename the files also.

locate – This command is basically used as a search command in windows. It is basically used to locate a files in the linux system. This command is very useful when you forget the location of the files or folder.

echo – This command is basically used to echo the word that you have typed.

chmod – “chmod” never changes the permissions of symbolic links; the chmod system call cannot change their permissions. This is not a problem since the permissions of symbolic links are never used. However, for each symbolic link listed on the command line, chmod changes the permissions of the pointed-to file. In contrast, chmod ignores symbolic links encountered during recursive directory traversals.

hostname – This command is basically used to know the network hostname of your Linux system. It is also used to display the IP address of your system. For example, if you want to display IP address using this command run hostname -I.

ping – This command is basically used to check the connection of a server. By wikipedia Ping is a computer network administration software utility used to test the reachability of a host on an Internet Protocol (IP) network. It is available for virtually all operating systems that have networking capability, including most embedded network administration software.

df – This command is basically used check disk space of your Linux system. You can type df -m to check the disk space in MB and df -h stands for human readable.

uname – This command is used to know the information about your Lnux system. uname -a prints the entire information about your system like kernel version, processor type, etc.

whoami – In Linux and Unix this command is used to print the username currently who is logged In to your system.

grep – This command is used to search text. It searches the given file for lines containing a match to the given strings or words.

kill – This command is basically used to kill the process that is running on your system. This command basically sends a signal to terminate a process. For example to kill any process just type kill followed by the process id.

wget – This command is basically used to download the file from the web. By this command, we can easily download a file from the server running HTTP, https, FTP protocols. For example, to run this command you just need to type wget followed by the url.

Some Tips and Trick for Linux Command line

TAB – This command is used to full fill the command. for example, if you type cd Dow and press tab it will auto-complete the directory name as cd Downloads.

ctrl+c and ctrl+z – These two command is basically used to stop or terminate any command safely.

clear – This command is basically used to clear the terminal screen if your terminal screen is messed up.

ctrl+shift+c and ctrl+shift+v“ctrl+shift+c” -> It is basically used to copy the command from terminal. “ctrl+shift+v” -> It is basically used to paste the command to your terminal.

exit – This command is basically used to exit from your terminal.

That’s all, for Now, I hope you all like this basic commands tutorial. If you have any doubt comment below.

Vedant Kumar

Currently I'm working as an Implementation Engineer, Started my career as an System Administrator - Linux. Additionally loves to explore new technologies and research about new open-source software that ease the development cycle.

View all posts by Vedant Kumar →

Leave a Reply

Your email address will not be published. Required fields are marked *


The reCAPTCHA verification period has expired. Please reload the page.

close

Ad Blocker Detected!

VEDANT EXPLAINS
We've noticed that you are using an ad blocker. Advertising helps fund our server cost and keep it truly independent. It helps to build our content creator team. So please disable your ad blocker, and help us to keep providing you with free- great content - for free. Thank you for your support.

Refresh