0% found this document useful (0 votes)
2 views4 pages

Linux Commands

This document provides a comprehensive list of Linux commands categorized by their functions, including file and directory management, process management, networking, user management, and more. Each command is accompanied by a brief explanation and examples of usage. It serves as a quick reference guide for users to understand and utilize various Linux commands effectively.

Uploaded by

dhrupaddutta20
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)
2 views4 pages

Linux Commands

This document provides a comprehensive list of Linux commands categorized by their functions, including file and directory management, process management, networking, user management, and more. Each command is accompanied by a brief explanation and examples of usage. It serves as a quick reference guide for users to understand and utilize various Linux commands effectively.

Uploaded by

dhrupaddutta20
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/ 4

Linux Commands with Explanations

File and Directory Management


ls: Lists files and directories in the current directory.

ls -l: Long listing format (permissions, ownership, size, modification time).

ls -a: Lists all files including hidden (.) files.

pwd: Prints the current working directory.

cd: Changes the current directory. Example: cd /home/user

mkdir: Creates a new directory. Example: mkdir new_folder

rmdir: Removes an empty directory.

rm: Removes files or directories. Example: rm file.txt, rm -r dir_name

cp: Copies files or directories. Example: cp file1.txt file2.txt

mv: Moves or renames files or directories. Example: mv old.txt new.txt

touch: Creates a new empty file or updates timestamp.

cat: Displays the contents of a file.

more / less: Views file content page-by-page.

find: Searches for files/directories. Example: find . -name "*.txt"

File Permissions and Ownership


chmod: Changes file permissions. Example: chmod 755 file.sh

chown: Changes file owner. Example: chown user:user file.txt

chgrp: Changes group ownership. Example: chgrp developers file.txt

umask: Sets default permissions for new files/directories.

Viewing and Editing Files


nano: Opens file in Nano text editor.

vim / vi: Opens file in Vim editor.

head: Displays first lines of a file. Example: head -n 5 file.txt


tail: Displays last lines of a file. Example: tail -f logfile.log

wc: Counts words, lines, and characters. Example: wc -l file.txt

Process Management
ps: Shows current processes.

top: Displays real-time system processes.

htop: Interactive process viewer (requires install).

kill: Sends signal to a process. Example: kill 1234

killall: Kills all processes with a given name. Example: killall firefox

nice / renice: Sets process priority.

Disk Usage
df: Shows disk space usage. Example: df -h

du: Shows disk usage of files/folders. Example: du -sh folder

mount: Mounts a filesystem.

umount: Unmounts a filesystem.

Networking
ping: Checks connectivity to a host. Example: ping google.com

ifconfig / ip a: Displays IP address and network info.

netstat: Shows active network connections (deprecated, use ss).

ss: Displays socket statistics and connections.

curl: Fetches data from URL. Example: curl http://example.com

wget: Downloads files from the internet.

scp: Secure copy over SSH. Example: scp file.txt user@host:/path

ssh: Secure Shell to remote machine. Example: ssh user@host

Package Management (APT)


apt update: Updates the package list.

apt upgrade: Installs available updates.


apt install package: Installs a package.

apt remove package: Removes a package.

dpkg -i package.deb: Installs a .deb package manually.

Package Management (YUM / DNF)


dnf install package: Installs a package.

dnf update: Updates all packages.

rpm -i package.rpm: Installs an .rpm package.

User Management
adduser / useradd: Adds a new user.

passwd: Changes user password.

deluser / userdel: Deletes a user.

groupadd: Creates a new group.

usermod: Modifies a user. Example: usermod -aG sudo user

System Information
uname -a: Shows kernel and system info.

uptime: Shows how long the system has been running.

hostname: Displays system hostname.

free -h: Displays memory usage.

lscpu: Displays CPU architecture info.

lsblk: Lists block devices.

dmesg: Kernel ring buffer messages (boot log).

Archiving and Compression


tar -cvf archive.tar file: Create a tar archive.

tar -xvf archive.tar: Extract tar archive.

tar -czvf archive.tar.gz folder: Create gzip-compressed tar archive.

gzip file: Compress file using gzip.


gunzip file.gz: Decompress a gzip file.

zip file.zip file1: Create zip file.

unzip file.zip: Extract zip file.

Search and Text Processing


grep "text" file: Searches for text in file.

awk '{print $1}' file: Pattern scanning and processing.

sed 's/old/new/' file: Stream editor (substitute text).

cut -d':' -f1 /etc/passwd: Cuts sections of text.

sort: Sorts lines of text.

uniq: Removes duplicate lines.

diff file1 file2: Shows difference between files.

Other Useful Commands


history: Shows command history.

alias: Creates shortcut for commands. Example: alias ll='ls -l'

echo: Displays message.

date: Displays or sets date and time.

cal: Displays calendar.

man command: Shows manual page of command.

whoami: Displays current user.

sudo: Executes command with superuser privileges.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy