Linux Terminal basic commands - complete guide for beginners

 

learn linux basic commands tutorial for beginners using terminal

Linux basic terminal commands complete guide - easy explanation

Linux is the most powerful and widely used operating system in the world. It is commonly used by the users who are interested in servers, cyber security, software development, networking and cloud computing etc.

Linux allows users to perform more tasks with the help of powerful tool called the terminal.

If you want to learn more about Linux operating system, read the blog you will get full information about Linux architecture.

What is Terminal??

The terminal is a command line interface (CLI) where users directly communicate with operating system using commands. Graphical interface is easier for normal computer users or beginners, but huge knowledge of commands gives users control, speed and efficiency.

We also discuss deeply on command line (CLI), read and learn deeply about Command line(CLI).

In this blog we will deeply learn about essential Linux terminal commands in details, categorized into:

  • File and directory management
  • File permissions and ownership
  • Process management
  • Package management

Each command will explain clearly. 

File and directory management commands

Ls

Ls command is show to display the list of file & folders.

ls - It shows all the file and folder in a directory.

Ls -1 - it shows details like (file permissions, size, owner and date).

Ls -a - it shows hidden files (files which are starting with a dot).

Ls -1h - it shows the file sizes in a human read able formats.

example of ls command listing files in Linux terminal
ls -l command showing detailed file information in Linux terminal
ls -a command displaying hidden files in Linux terminal

Cd

The cd command is used to move file from one directory to another.

Cd - (directory name)

cd documents - moves into documents folder

cd .. - moves one step back

cd / - move to the root directory

cd command navigating to Documents directory in Linux termina
cd .. command moving to parent directory in Linux terminal

Mkdir

The mkdir command is basically used for creating a new directory.

mkdir foldername

mkdir project

mkdir command creating new folder in Linux terminal

Rm

The rm command is used to delete a file and folder.

To delete a file:

rm file_name

To delete a folder:

rm -r folder_name

rm command deleting file in Linux terminal

Cp

The cp command used to copies files from one location to another.

To copy a file:

Cp file1.txt file2.txt

To copy a directory:

Cp -r folderno1 folderno2

cp command copying file from one location to another in Linux

Mv

The mv command is basically used to move a file or also rename a file.

For rename:

mv oldname.txt newname.txt

For move:

file.txt /home/user/

mv command moving or renaming files in Linux terminal

Commands such as ls, cd and mkdir help user to navigate and manage files in linux Filesystem structure.

File permission and ownership commands

Chmod

chmod is used to change file permission. Each file has three types of permissions read (r), write (w) or execute.

These permissions are represented by numbers like 4 = read, 2 = write and 1 = execute.

When they are together:

For example:

7 = 4+2+1 (which means full permissions)

6 = 4+2 (read and write)

5 = 4+1 (read + execute)

chmod 777 file.txt (which means giving thee full permission).

chmod command modifying file permissions in Linux terminal

Chown

The chown command is used to change the owner of a file.

chown admin file.txt (which means this changes the owner of file "admin").

chown command change file owner

Process management commands

Ps

It is a process state which shows the information about currently running process.

For basic view:

ps

For detailed view:

ps aux

This process shows the process ID, CPU usage, memory usage and running processes.

ps command displaying active processes in Linux terminal
ps aux command showing detailed process information in Linux

Top

The top commands show the real-time system performance.

top

top command monitoring cpu and memory usage in Linux terminal

To exit:

q Command is used to exit.

Package management commands

Apt

Apt is an advanced package tool, which is used in debian-based distributions.

For update:

sudo apt update

apt update command updating package lists in Ubuntu Linux

For install:

sudo apt install vlc

apt install command installing software package in Ubuntu Linux

For remove:

sudo apt remove vlc

apt remove command uninstalling software package in Ubuntu

yum

Yum used in redHat-based systems.

For install:

sudo yum install httpd

For update:

sudo yum update

Yum perform same task as apt but in red-hat based systems.

Why Linux terminal commands is important?

Good understanding of Linux terminal commands provide user:

  • Huge control on computer system
  • Task execution within a computer
  • Improve your troubleshooting skills
  • Good knowledge of networking, cyber security and IT.
  • Strong foundation of system administration

Understanding these command is a fundamental skill for beginners.

Interview questions to remember

Use of ls command?

Answer:
ls command is used to show all the list of files and directories which is in the current working stage.

Differentiate between ls or ls -1?

Answer:
ls shows only file & folders names while ls -1 shows detail of that file and folders like permissions, owner, size, date and other details.

Uses of cd command?

Answer:
cd command is used to change to current directory and move to another directory.

Explain the use of mkdir?

Answer:
mkdir is used to make new folder or directory.

How to delete file in Linux using commands?

Answer:
rm command is used in Linux to delete a file (rm file.txt).

How to deleted directory in Linux using commands?

Answer:
We use rm command to deleted directory, for example (rm –r directory name).

Can you tell the Difference between cp or mv commands?

Answer:
cp command used to copy a file or folder from one location to another on the other hand mv used to move a file or rename.

Define the file permission of Linux?

Answer:
File permissions controls the permissions of read, write and execute a file or folder, there are three types of file permission, Read (r), write (w) and execute (x).

Uses of chmod command?

Answer:
chmod used to changes file permissions. It gives full permission to all users.

Explain chmod 777?

Answer:
777 means to gives the full permission to everyone, for example:

Owner, group, others: Read, Write, and Execute

Uses of chown command?

Answer:
chown used to changes the owner of a file or directory.

Define process in Linux?

Answer:
A process is a running program in the system.

Uses of ps command?

Answer:
ps shows information about currently running processes.

Differentiate between ps and top command?

Answer:
ps basically shows a static list of process while top shows real time system performance.

How to exit top command?

Answer:
you should press q to exit.

Can we install software in line using terminal?

Answer:
yes we can install software using Linux terminal like sudo apt install and then package name.

What is the use of sudo before commands?

Answer:
sudo allows user to run command with the administrative permissions.

Which command you use for rename a command?

Answer:
Use mv oldname to newname.

How can you check processes?

Answer:
Use the top command.

How to move a file to another directory?

Answer:
mv file.txt /path/to/directory

Explain the root directory in Linux?

Answer:
root directory is /. It is the top level directory in Linux.
 

Conclusion

Linux terminal commands are basically most powerful tools that allow users to interact with the users directly, basic commands involve:

  • Ls
  • cd
  • mkdir
  • rm
  • cp
  • mv
  • chmod
  • chown
  • ps
  • top
  • apt
  • yum

Each command is important for Linux users. By practicing these commands you can confidently work in Linux environment. It is not about to just memorizing command, it is about to understanding of how Linux works internally.

you can easily practice linux command using virtual machines, start today learning about Virtual Machine and practicing the commands.

Comments

Popular posts from this blog

BIOS and Booting Process Explained – Complete Guide for Beginner

Processes & Services: Complete Guide for Beginners

What is a Virtual Machine? Complete Guide For Beginners