Basic Linux Commands You Must Know

Spread the love

Essential Linux Commands: A Quick Reference Guide

Linux commands are the foundation of effective system administration and everyday tasks. Whether you are a beginner or an experienced user, knowing these fundamental commands is essential. Let us look at some key commands that will help you navigate the Linux environment with ease.

Date and Time Commands:

Display the current date and time.

date

View the calendar

Example: cal
Example: cal 5 2010 (display May 2010 calendar)

File and Directory Management:

Clear the terminal screen.

clear

List directories and files.

ls

Create a new user.

useradd vishal

Set or change a user password.

passwd vishal

Create a user without a password.

passwd -d vishal

Rename a user.

usermod -l n-name o-name

Add a user to a group.

usermod -g group user

Create a user without a duplicate directory.

useradd -n vishal

Delete user with their directory.

userdel -r vishal 

Forcefully remove a directory.

rm -rf directory

View group memberships.

groups vishal

View user directory.

vi /etc/passwd

Create a group.

groupadd sales

View group directory.

vi /etc/group

Rename a group.

groupmod -n n-name o-name

How to find files in Linux :

Find the file using file name in Linux.

find /home/user/Documents -name "report.txt"

Find the file using it’s extension in Linux.

find /home/user/Documents -name "*.pdf"

Find the file by size in linux (larger than 10 MB)

find /home/user/Documents -size +10M

System and Configuration:

Switch user.

su vishal

Graphically view any configuration.

system-config-

Create a new tab.

ctrl+shift-t

Switch to the next/previous tab.

ctrl+PgUp/Dn

View files of any command.

/usr/share/doc

Other Useful Commands:

View help about any calendar.

whatis cal

View detailed help about the date command.

date --help

View manual pages about ls.

man ls

View information about history.

info history

Find the path of any directory or command.

which dir

Refers to your home directory.

 ~ (Tilde)

Time-Saving Tips:

Fully stop a command.

ctrl+c 

Stop the terminal.

ctrl+d

Send a program into the background or temporary halt.

ctrl+z

Check programs running in the background.

jobs

Bring a halted program back to run.

fg 1 or 2 or 3

Conclusion:

These Linux commands provide a foundation for effective system management. Whether you are dealing with files, users, or configurations, mastering these commands will boost your productivity. Stay tuned for more Linux tips and tricks at Linux Guru!

See also  How to create simple react app Linux guru

Leave a Comment