In this tutorial you’ll learn basic and the most used Linux commands. This Linux Command Cheatsheet For Beginners will help you gain the necessary understanding of daily task execution through the terminal.
Linux is the preferred Operating system among professional developers because it makes very efficient use of the system’s resources.
The commands discussed below may not help you become a pro in a day, but practicing all and learning new things along with implementing everything in a positive manner will make you an efficient Linux user.
1. File Management
ls
Lists all the files in the current directory
ls -l
Shows files along with permissions
ls -al
Shows a list of all the files including hidden Files
ls -lt
Sorting the listing by time modification
pwd
Shows the Present Working Directory
cd
Prints Current Directory
cd ..
Change the directory to the parent directory
cd –
change to the previous directory
cd dir_name
Change the directory to “dir_name”
mkdir dir_name
Make a directory with “dir_name”
cat > filename
Creates a new file with ‘filename’
cat filename
Displays file content
cat file1 file2 > file3
Concatenate or joins two files in one
touch filename
Create a new file with ‘filename’
rm filename
Removes the file
rm -r dir
Removes a directory named ‘dir’
cp file1 file2
Copy file1 and call it file2
cp -r dir1 dir2
Copy contents of directory ‘dir1’ to ‘dir2’
mv file1 file2
Move file1 to file2
echo ‘Hi’ > data.txt
Enters content to a file
echo ‘There!’ >> data.txt
Append text to existing file in Linux
nano filename
Opens file in an editor
vim filename
Enables efficient text editor
tar -cvf archived.tar /indgeek
Compress files and folders in Linux
tar -xvf archived.tar
Extracts the tar archive file
2. Management Commands
sudo
Allows regular users to run with Superuser privileges
apt-get
Command used to install and update packages
ps
Displays the current working processes
man
Opens the help manual of a command
pidof
Gives the Process ID (PID) of a process
kill PID
Kill the process with the given PID
top -u igeek
Display specific User process details
nice
Starts a process with a given priority
renice
Changes priority of an already running process
df
Gives free hard disk space on your system
free
Gives free RAM on your system
bg
To send a process to the background
fg
To run a stopped process in the foreground
3. Permissions
Linux permissions grating is a tricky task that you may memorize with simple syntaxes.
Remember providing ‘Read Permission‘ to any user would only allow them to read the file, that specific user won’t be able to write/ modify or execute that file or application.
Users:
Every file and directory on a Linux system can be assigned 3 types of Owners,
Owner: The Owner is the creator of a specific file or Directory
Group: A Group can contain multiple users
Others: A person who has neither created the file nor belongs to a user group who owns the file.