Contact Us
Email: info@mohitdesigns.com
Mobile: +91-9718991639
Contact Us
Email: info@mohitdesigns.com
Mobile: +91-9718991639

If you’re diving into the world of Linux, mastering a few key commands will set you up for success. While Linux might seem complex at first, these commands make daily tasks fast and efficient. Whether you’re a beginner or a seasoned user, this guide will cover essential Linux commands to streamline your workflow. So, let’s explore these commands with practical examples to get you comfortable with Linux quickly!
The pwd command displays the current working directory path, useful for knowing exactly where you are within the file system.
pwd
# Example Output: /home/user/DocumentsThe ls command shows the files and directories in your current location. To see hidden files, use the -a option.
ls
# Lists all files and directories
ls -a
# Lists hidden files tooUse cd to navigate between directories. If you want to move up a directory, use cd ...
cd /home/user/Documents
cd .. # Moves up one directoryThe mkdir command creates a new directory. Add -p to create parent directories if they don’t exist.
mkdir project
mkdir -p project/subfolderThe rmdir command deletes an empty directory. If there are files inside, use rm -r instead.
rmdir project/subfolder
rm -r project # Removes a directory with filesCreate an empty file with touch. This is great for setting up placeholder files.
touch newfile.txtCopy files with cp. Use -r for directories to include all contents.
cp file.txt /destination/
cp -r folder /destination/The mv command moves files and directories and can also rename them.
mv oldfile.txt newfile.txt # Renames file
mv file.txt /destination/ # Moves fileDelete files with rm, adding -r to remove directories.
rm file.txt
rm -r folderUse cat to display file content. It’s quick for short files or to combine files.
cat file.txt
cat file1.txt file2.txt > combined.txtThe nano command opens a simple editor, great for quick text edits.
nano file.txtThe find command locates files. Add filters like -name to search by name.
find /home/user -name "*.txt"grep lets you search for text within files, handy for quickly finding content.
grep "search_term" file.txt
grep -r "search_term" /path/to/searchUse chmod to modify permissions, using symbolic or numeric representations.
chmod 755 script.sh
chmod u+x script.sh # Adds execute permission for the ownerThis command changes the ownership of files or directories.
chown user:group file.txtecho outputs text or appends it to a file.
echo "Hello, Linux!" > file.txtThe df command shows disk space usage for mounted filesystems.
df -hdu displays space used by files and directories. Use -h for readability.
du -h /path/to/directoryUse tar to compress and archive files. Add -z to create a .tar.gz file.
tar -czvf archive.tar.gz /path/to/filesUnzip compressed .zip files with this simple command.
unzip archive.zipps lists currently running processes, useful for troubleshooting.
ps auxkill lets you end processes by ID. Use ps to find the process ID.
kill 1234top shows active processes in real-time, including CPU and memory usage.
topUse wget to download files from the web.
wget http://example.com/file.zipThe curl command fetches data from URLs, useful for API calls.
curl http://example.comalias lets you create command shortcuts.
alias ll='ls -la'This command shows previously entered commands, perfect for recalling past actions.
historyclear removes the clutter by clearing the terminal.
clearQuickly restart your Linux system with this command.
rebootThe shutdown command shuts down or restarts your system with scheduling options.
shutdown now # Immediate shutdown
shutdown -r +5 # Restarts in 5 minutesWith these essential Linux commands, you’re now equipped to handle most tasks confidently. Try incorporating these commands into your routine, and soon you’ll feel like a Linux pro! Linux commands are powerful tools for navigating and managing your system. As you explore these further, you’ll see just how efficient they can make your workday.
If you’re interested in choosing the right distribution, check out our guide on the best Linux distros to find one that fits your needs and preferences.
For more detailed explanations of these and other Linux commands, explainshell.com is a fantastic resource that breaks down commands step-by-step.