Learn Linux terminal, from zero to hero: the complete beginner Linux guide for command line mastery

The Linux terminal, also known as the command line or shell, is a text-based interface that allows users to interact with the operating system using commands. It provides a powerful and efficient way to perform various tasks and manage the system.

Ben Turner
2 min readJun 8, 2023

FOR COMMANDS AND THEIR DEFINITIONS CHECK THE STORY:

https://kkcom.medium.com/learn-linux-terminal-linux-shell-from-zero-to-hero-the-complete-beginner-linux-guide-for-e99874c34c50

LISTING FILES AND DIRECTORIES:

ls Lists the files and directories in the current directory

ls -l Displays information about files and directories like:

  • permissions
  • owner
  • size
  • modification time

ls -a Shows all files and directories, including hidden ones starting with ‘.’

NAVIGATING DIRECTORIES

cd Changes the current directory

# Moves to the 'Documents' directory
cd Documents

cd ..Moves up one directory level

pwd Prints the current working directory

CREATING AND DELETING FILES/DIRECTORIES

mkdir: Creates a new directory

# Creates a directory named 'new_directory'
mkdir new_directory

touch: Creates a new empty file

# creates a file named 'new_file.txt'
touch new_file.txt

rm Removes (deletes) files and directories

# deletes the file named 'file.txt'
rm file.txt

# deletes the 'directory' and its contents (files/folders) recursively
rm -r directory

tar Zip or unzip a file

# zip file into a tar file
tar -cvf file_name src_folder

# unzip tar file
tar -xvf file_name

VIEWING FILE CONTENTS:

cat Displays the contents of a file.

# prints the contents of 'file.txt' to the terminal
cat file.txtba

less Allows scrolling through large files.

# opens 'big_file.txt' for browsing
less big_file.txt

COPYING, MOVING, AND RENAMING FILES/DIRECTORIES:

cp Copies files and directories

# copies 'file.txt' to the specified destination
cp file.txt /path/to/destination

mv Moves or renames files and directories

# moves 'file.txt' to the 'new_location' directory
mv file.txt new_location/file.txt

Running programs and executing scripts:

./ Executes a script or program in the current directory

# Runs the shell script named 'script.sh'
./script.sh

THE STORY IS BEING UPDATED…

--

--

Ben Turner
Ben Turner

No responses yet