A Handy Guide for Basic Linux Commands
Linux, an open-source Operating System is one of the most popular operating systems which takes inputs in the form of commands to direct a computer program to perform a specific task. To use this Operating System we need to get familiar with the commands to navigate between directories, manipulate files, change permissions, display disk information, and many more other tasks.
In the article, we will walk you through some of the most common Linux Commands that will make your life easier no matter whether you are new to the Linux interface or an experienced user.
Find the most common Linux Commands in this table :
FILES & NAVIGATING
ls | directory listing |
ls -l | formatted listing |
ls -la | formatting listing including hidden files |
touch file_name | creates a new file |
pwd | show current working directory |
mkdir dir | create a directory(dir -> directory name) |
mkdir -p | It will create the parent directory first if it doesn’t exist. But if it already exists, then it will not print an error message and will move further to create sub-directories. |
rm file | delete file |
rm -rf dir | remove directory(dir -> directory name) |
cp file1 file2 | copy file1 to file2 |
cat file | show the output for the contents of a file |
mv file1 /home/oracle/file2 | used to move and rename files |
grep | used to search a given pattern in a file |
PROCESSES
ps | displays currently active process |
top | displays all running processes |
kill pid | Terminates processes with a given pid |
kill all proc | kill/terminates all processes named proc |
bg | Resumes suspended jobs in the background |
fg | Brings suspended jobs to the foreground |
SYSTEM INFO
date | displays current date and time of the system |
uptime | displays how long the system is running including load average |
uname -a | displays Linux kernel system information |
hostname | shows the system hostname |
last reboot | shows system reboot history |
cal | displays current calendar month and day |
whoami | displays who you are logged in as |
history | used to review commands entered before |
man | manual for Linux commands |
locate | used to locate a file |
find | searches for files within a given directory |
PERMISSIONS
chmod octal filename | change file permissions to octal |
chmod 777 | set read/write/execute permission to owner,group, and everyone having access to the server |
chmod 755 | set read/write/execute permission to owner and r_x to group and everyone |
chmod -R 777 | The -R argument also means that it is recursive so the permission change applies to every file in that directory. |
chown -r | change ownership of a file recursively |
chown owner-user:owner-group filename | change owner and group owner of the file |
DIRECTORY TRAVERSE
cd | change directory to $HOME directory |
cd .. | Move up one level in the directory tree structure |
cd /test | change directory to /test |
DISK USAGE
df -kh | displays free space on mounted system in KB |
du -sh | displays disk usage in the current directory in a human-readable format |
df -i | displays free inodes on file systems |
This document is just for learning purpose and always validate in the LAB environment first before applying in the LIVE environment.
Hope so you like this article!
Please share your valuable feedback/comments/subscribe and follow us below and don’t forget to click on the bell icon to get the most recent update. Click here to know more about our pursuit.
Related Articles
- How to Enable PasswordLess SSH login in Linux
- Steps to Install & Configure SNMP in Oracle Linux 7
- Steps to Add and Extend Swap Space in Linux
- Steps To Increase Mount Point Space In Oracle Linux
- Steps to Move ISCSI Target to Another Linux Server
perfectly useful 👍🏼
Hi Tejaswini,
Great to hear your feedback.
Do keep following us for many more articles !
Thanks and regards,
Team DBsGuru
Thank you so much Sruti and team for such a wonderful post.
Appreciate your time and feedback which encourage us!
Thanks.
Team DBsGuru