Linux Commands
Basic Linux Commands
Navigation and Directory Management:
pwd: Print working directory.
ls: List directory contents.
cd [directory]: Change directory.
mkdir [directory]: Create a new directory.
rmdir [directory]: Remove an empty directory.
rm -r [directory]: Remove a directory and its contents recursively.
File Operations:
touch [file]: Create an empty file or update the timestamp
of an existing file.
cp [source] [destination]: Copy files or directories.
mv [source] [destination]: Move or rename files or
directories.
rm [file]: Remove files.
Viewing and Editing Files:
cat [file]: Concatenate and display file content.
more [file] or less [file]: View file content with
pagination.
head [file]: Display the first 10 lines of a file.
tail [file]: Display the last 10 lines of a file.
nano [file] or vi [file]: Edit files using nano or vi
editors.
System Information:
System Status
df: Display disk space usage.
du: Display disk usage of files and directories.
free: Display memory usage.
top: Display real-time system processes.
uname -a: Display system information.
User and Permission Management:
whoami: Display the current logged-in user.
id: Display user identity.
chmod [permissions] [file]: Change file permissions.
chown [owner]:[group] [file]: Change file owner and group.
Network Operations:
Networking
ifconfig: Configure network interfaces.
ping [host]: Check network connectivity to a host.
wget [url]: Download files from the internet.
curl [url]: Transfer data from or to a server.
Process Management:
Process Control
ps: Display currently running processes.
kill [pid]: Terminate a process by its process ID.
killall [process_name]: Terminate all processes with the
given name.
jobs: List active jobs.
bg: Resume a suspended job in the background.
fg: Bring a background job to the foreground.
File Search:
Searching
find [path] -name [name]: Find files by name.
grep [pattern] [file]: Search for a pattern in a file.
locate [name]: Find files by name using a pre-built
database.
which [command]: Locate a command.
Package Management (Debian-based systems like Ubuntu):
Package Installation and Management
sudo apt update: Update package lists.
sudo apt upgrade: Upgrade all installed packages.
sudo apt install [package]: Install a package.
sudo apt remove [package]: Remove a package.
sudo apt autoremove: Remove unnecessary packages.
Comments
Post a Comment