0% found this document useful (0 votes)
8 views3 pages

Linux Command Line Basics

This document is a basic guide to Linux command line operations, covering file and directory management, file viewing and editing, searching, system information, permissions, package management, archives, and other useful commands. It provides a list of essential commands along with their descriptions for various tasks. The guide is structured into sections for easy reference.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views3 pages

Linux Command Line Basics

This document is a basic guide to Linux command line operations, covering file and directory management, file viewing and editing, searching, system information, permissions, package management, archives, and other useful commands. It provides a list of essential commands along with their descriptions for various tasks. The guide is structured into sections for easy reference.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Basic Linux Command Line Guide

FILE & DIRECTORY MANAGEMENT


---------------------------
ls - List files in current directory
ls -l - Long listing format
cd <dir> - Change directory
pwd - Print working directory
mkdir <dir> - Create a directory
rmdir <dir> - Remove empty directory
rm <file> - Remove file
rm -r <dir> - Remove directory recursively
cp <src> <dest> - Copy file/directory
mv <src> <dest> - Move or rename file/directory
touch <file> - Create an empty file

FILE VIEWING & EDITING


---------------------------
cat <file> - View file content
less <file> - View file with scroll (q to quit)
head <file> - First 10 lines of file
tail <file> - Last 10 lines of file
nano <file> - Edit file in nano editor
vim <file> - Edit file in vim editor

SEARCHING & FINDING


---------------------------
find <path> -name <file> - Find file by name
grep "text" <file> - Search text in file
grep -r "text" <dir> - Search recursively

SYSTEM INFORMATION
---------------------------
whoami - Current user
hostname - System hostname
top - Running processes (press q to quit)
df -h - Disk space usage
free -h - Memory usage

PERMISSIONS & OWNERSHIP


---------------------------
chmod +x <file> - Make file executable
chmod 755 <file> - Set file permissions (rwxr-xr-x)
chown user:group <file> - Change file ownership

PACKAGE MANAGEMENT (Ubuntu/Debian)


---------------------------
sudo apt update - Refresh package index
sudo apt upgrade - Upgrade installed packages
sudo apt install <pkg> - Install a package
sudo apt remove <pkg> - Remove a package

ARCHIVES & COMPRESSION


---------------------------
tar -cvf file.tar dir/ - Create tar archive
tar -xvf file.tar - Extract tar archive
tar -czvf file.tar.gz dir/ - Create gzip compressed tarball
tar -xzvf file.tar.gz - Extract gzip tarball
unzip file.zip - Extract zip file

OTHER USEFUL COMMANDS


---------------------------
history - Show command history
clear - Clear terminal screen
echo "text" - Print text to terminal
man <command> - Manual page for command (q to quit)
alias ll='ls -l' - Create shortcut command

You might also like