[go: up one dir, main page]

0% found this document useful (0 votes)
39 views6 pages

Linux Commands 100

The document provides a comprehensive list of 100 basic Linux commands along with their descriptions and examples. Each command serves a specific purpose, such as file management, system monitoring, and user administration. This resource is useful for both beginners and experienced users looking to enhance their command-line skills.

Uploaded by

bcamsccs2015
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)
39 views6 pages

Linux Commands 100

The document provides a comprehensive list of 100 basic Linux commands along with their descriptions and examples. Each command serves a specific purpose, such as file management, system monitoring, and user administration. This resource is useful for both beginners and experienced users looking to enhance their command-line skills.

Uploaded by

bcamsccs2015
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/ 6

100 Basic Linux Commands with Description and Examples

No. Command Description Example

1 pwd Displays the current working directory path. Helpful to know... pwd

2 ls Lists files and directories. Add `-l` for detailed info or `... ls -la

3 cd Changes directory. Use `..` to go up one level. cd /home/user

4 touch Creates an empty file. Useful for quickly creating files for... touch file.txt

5 mkdir Makes a new directory. Use `-p` to create nested folders. mkdir myfolder

6 rm Deletes files. Use `-r` for directories and `-f` to force de... rm -rf folder/

7 cp Copies files or folders. Add `-r` for directories. cp file.txt backup/

8 mv Moves or renames files or directories. mv old.txt new.txt

9 cat Shows file content. Also used to combine files. cat file.txt

10 nano Opens a simple terminal-based text editor. Easy to use. nano file.txt

11 vi / vim Opens a powerful text editor. Preferred by advanced users. vi file.txt

12 clear Clears the terminal screen. Handy for reducing clutter. clear

13 man Opens manual page for a command. Includes syntax and options... man ls

14 chmod Changes file permissions (read, write, execute). chmod 755 script.sh

15 chown Changes file owner and group. Requires root permission. chown user:group file.txt

16 df Shows disk space usage of mounted file systems. Add `-h` for... df -h

17 du Displays disk usage of files/directories. Add `-sh` for summ... du -sh *


18 top Displays real-time processes and system resource usage. top

19 ps Shows currently running processes. ps aux

20 kill Terminates a process by its PID. kill 1234

21 killall Terminates all processes by name. killall firefox

22 history Displays the list of previously used commands. history

23 echo Displays text or variables in the terminal. echo 'Hello World'

24 whoami Prints the current logged-in username. whoami

25 uname Shows system information. Add `-a` for all details. uname -a

26 hostname Displays or sets the system's hostname. hostname

27 ifconfig Displays IP and network interface info (older systems). ifconfig

28 ip a Shows network interfaces and IP addresses. ip a

29 ping Checks network connectivity with another system. ping google.com

30 wget Downloads files from the internet. wget http://example.com/file.txt

31 curl Transfers data from or to a server. Handy for APIs. curl https://example.com

32 tar Archives files. Use with `-x` to extract. tar -xvf archive.tar

33 zip Compresses files into a .zip file. zip file.zip file.txt

34 unzip Extracts .zip files. unzip file.zip

35 find Searches for files and directories. find . -name 'file.txt'

36 locate Quickly finds files by name (uses a database). locate file.txt


37 grep Searches text using patterns (regular expressions). grep 'text' file.txt

38 head Shows the first 10 lines of a file. Use `-n` to set lines. head -n 5 file.txt

39 tail Shows the last 10 lines of a file. Useful for logs. tail -f logfile.txt

40 alias Creates shortcuts for commands. alias ll='ls -la'

41 unalias Removes an alias. unalias ll

42 export Sets environment variables temporarily. export PATH=$PATH:/new/path

43 env Displays environment variables. env

44 source Runs a script in the current shell. source ~/.bashrc

45 crontab Schedules tasks to run automatically. crontab -e

46 service Starts/stops services in older systems. service apache2 start

47 systemctl Manages services and system processes. systemctl status ssh

48 mount Mounts a storage device or partition. mount /dev/sdb1 /mnt

49 umount Unmounts a mounted filesystem. umount /mnt

50 sudo Executes a command with superuser privileges. sudo apt update

51 lsblk Lists block devices like hard drives and USBs. lsblk

52 blkid Shows block device attributes such as UUID and type. blkid

53 fdisk Used to partition disks. Works with MBR. sudo fdisk /dev/sda

54 parted Tool for creating and modifying disk partitions. sudo parted /dev/sda

55 mkfs Formats a disk partition with a file system. mkfs.ext4 /dev/sdb1


56 fsck Checks and repairs a Linux file system. sudo fsck /dev/sda1

57 dd Copies and converts data at the byte level. dd if=/dev/sda of=/backup.img

58 uptime Shows how long the system has been running. uptime

59 who Shows who is logged into the system. who

60 w Shows who is logged in and what they are doing. w

61 last Displays login history of users. last

62 groups Shows groups a user belongs to. groups username

63 adduser Adds a new user to the system. sudo adduser student

64 userdel Deletes a user from the system. sudo userdel student

65 groupadd Creates a new group. sudo groupadd editors

66 passwd Changes a user's password. passwd username

67 id Displays UID, GID, and groups for a user. id

68 su Switches to another user (or root) shell. su -

69 df -i Displays inode usage instead of disk usage. df -i

70 watch Runs a command repeatedly every few seconds. watch df -h

71 basename Extracts file name from path. basename /home/user/file.txt

72 dirname Extracts directory name from path. dirname /home/user/file.txt

73 xargs Converts input into arguments for a command. cat list.txt | xargs rm

74 tee Reads input and writes to both stdout and files. echo 'text' | tee file.txt
75 yes Continuously prints a string until stopped. yes Y

76 cut Removes sections from each line of input. cut -d':' -f1 /etc/passwd

77 tr Translates or deletes characters. tr a-z A-Z

78 sed Stream editor for modifying text in files. sed 's/old/new/g' file.txt

79 awk Pattern scanning and processing language. awk '{print $1}' file.txt

80 diff Compares two files line by line. diff file1.txt file2.txt

81 cmp Compares two files byte by byte. cmp file1.txt file2.txt

82 sort Sorts lines in a file. sort names.txt

83 uniq Removes duplicate lines from a sorted file. uniq sorted.txt

84 wc Counts lines, words, and characters in a file. wc file.txt

85 split Splits a file into smaller files. split -l 1000 file.txt

86 head -c Shows the first bytes of a file. head -c 50 file.txt

87 tail -n Shows the last `n` lines of a file. tail -n 20 file.txt

88 stat Displays detailed info about a file. stat file.txt

89 time Measures time taken to run a command. time ls

90 bc Command-line calculator. echo '5+3' | bc

91 hostnamectl Views or changes the system hostname. hostnamectl set-hostname newhost

92 journalctl Views system logs in systems using `systemd`. journalctl -xe

93 logger Adds custom messages to system logs. logger 'Backup completed'


94 rsync Synchronizes files/directories between locations. rsync -av source/ dest/

95 scp Securely copies files over SSH. scp file.txt user@host:/path

96 ssh Connects securely to remote systems. ssh user@192.168.1.10

97 logout Logs out of the current terminal session. logout

98 uptime Shows system uptime and average CPU load. uptime

99 ls -lh Lists files with sizes in human-readable format. ls -lh

100 ls -R Recursively lists directories and subdirectories. ls -R

You might also like