Linux Basics: A Beginner’s Guide to Essential Commands
pwd – Print Working DirectoryShows the current directory (folder) you're in.
pwdExample Output:
/home/username
ls – List Directory ContentsLists files and directories in the current folder.
ls # Basic list
ls -l # Detailed list (permissions, size, etc.)
ls -a # Shows hidden files (starting with '.')cd – Change DirectoryMoves you into a different directory.
cd Documents # Move into "Documents"
cd .. # Go up one directory
cd ~ # Return to home directory
cd / # Go to the root directorymkdir – Make DirectoryCreates a new folder.
mkdir new_foldertouch – Create a FileCreates an empty file.
touch file.txtcp – Copy Files/DirectoriesCopies a file or directory.
cp file.txt /backup/ # Copy file to another location
cp -r folder/ backup/ # Copy a directory recursivelymv – Move or Rename FilesMoves files or renames them.
mv file.txt new_name.txt # Rename
mv file.txt ~/Documents/ # Move to another directoryrm – Remove Files/DirectoriesDeletes files or directories (use with caution!).
rm file.txt # Delete a file
rm -r folder/ # Delete a directory and its contentscat – Display File ContentsPrints the contents of a file.
cat file.txtless / more – View Files Page by PageAllows scrolling through large files.
less long_file.txt
more long_file.txtnano / vim – Text EditorsSimple text editors for modifying files.
nano file.txt # Easy-to-use editor
vim file.txt # More advanced (press `i` to edit, `Esc` then `:wq` to save & exit)df – Disk Space UsageShows disk space on mounted filesystems.
df -h # Human-readable format (MB/GB)free – Memory UsageDisplays RAM and swap usage.
free -htop / htop – Process MonitorLists running processes (press q to exit).
top # Basic process viewer
htop # More interactive (may need installation)ps – Process StatusLists currently running processes.
ps aux # Detailed process listchmod – Change File PermissionsModifies read (r), write (w), and execute (x) permissions.
chmod +x script.sh # Make a file executable
chmod 755 file.txt # Sets permissions numerically (rwxr-xr-x)chown – Change File OwnerChanges the owner of a file/directory.
sudo chown user:group file.txtping – Test Network ConnectionChecks connectivity to a server.
ping google.comifconfig / ip – Network Interface InfoDisplays network interfaces and IP addresses.
ifconfig # Older command (may require installation)
ip a # Modern alternativewget / curl – Download FilesDownloads files from the internet.
wget https://example.com/file.zip
curl -O https://example.com/file.zipapt – Install/Remove SoftwareManages packages on Debian-based systems.
sudo apt update # Update package list
sudo apt install package # Install a package
sudo apt remove package # Remove a packageThese basic Linux commands will help you get started with file management, system navigation, and troubleshooting. As you become more comfortable, you can explore more advanced commands and scripting.
Have questions or need further explanations? Drop a comment below!
Happy Linux-ing!
Did you find this helpful? Share it with fellow Linux beginners!
Next up: Advanced Linux Commands for Power Users!
Would you like any additions or modifications to this post? Let me know!