0% found this document useful (0 votes)
11 views

Linuxcheat Sheet

This document contains a list of over 50 useful Linux commands along with examples and descriptions of what each command does.
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)
11 views

Linuxcheat Sheet

This document contains a list of over 50 useful Linux commands along with examples and descriptions of what each command does.
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/ 9

Linux Cheat sheet

This cheat sheet contains more than 50 command which is very useful and powerful commands in
linux. Share this document.

Follow for more -


https://www.linkedin.com/in/krishan-bhatt-bab295194

Read Carefully💻💻

Certainly! Here are some advanced Linux commands:

1. **find**: Search for files in a directory hierarchy.


```
find /path/to/search -name "filename"
```

2. **grep**: Search for patterns in files.


```
grep "pattern" /path/to/file
```

3. **awk**: Text processing tool for pattern scanning and processing.


```
awk '{print $2}' filename
```

4. **sed**: Stream editor for filtering and transforming text.


```
sed 's/old_text/new_text/g' filename
```

5. **tar**: Create or extract tar archives.


```
tar -cvzf archive.tar.gz /path/to/folder
```

6. **rsync**: Remote file and directory synchronization.


```
rsync -avz /source/path/ user@remote:/destination/path/
```

7. **ssh**: Secure Shell for accessing remote machines.


```
ssh user@hostname
```

8. **chmod**: Change file permissions.


```
Linux Cheat sheet
chmod permissions filename
```

9. **chown**: Change file ownership.


```
chown user:group filename
```

10. **df**: Display free disk space.


```
df -h
```
11. **top**: Display and manage system processes in real-time.
```
top
```

12. **htop**: Interactive process viewer, an advanced alternative to top.


```
htop
```

13. **lsof**: List open files and the processes that opened them.
```
lsof /path/to/file
```

14. **netstat**: Display network connections, routing tables, interface statistics, masquerade
connections, etc.
```
netstat -an
```

15. **du**: Estimate file space usage.


```
du -sh /path/to/directory
```

16. **fdisk**: Partition table manipulator for Linux.


```
fdisk /dev/sdX
```

17. **curl**: Command-line tool for transferring data with URLs.


```
curl -O https://example.com/file.tar.gz
```

18. **wget**: Non-interactive network downloader.


```
wget https://example.com/file.zip
Linux Cheat sheet
```

19. **journalctl**: Query and display messages from the journal, managed by `systemd-journald`.
```
journalctl -xe
```

20. **iptables**: Administration tool for IPv4 packet filtering and NAT.
```
iptables -L
```
21. **ps**: Display information about active processes.
```
ps aux
```

22. **kill**: Terminate a process by its process ID (PID).


```
kill -9 PID
```

23. **ifconfig**: Display or configure network interface parameters.


```
ifconfig
```

24. **route**: Show or manipulate the IP routing table.


```
route -n
```

25. **ping**: Send ICMP ECHO_REQUEST to network hosts.


```
ping example.com
```

26. **traceroute**: Print the route that packets take to a network host.
```
traceroute example.com
```

27. **useradd**: Create a new user account.


```
useradd username
```

28. **passwd**: Change user password.


```
passwd username
```
Linux Cheat sheet
29. **groupadd**: Create a new group.
```
groupadd groupname
```

30. **usermod**: Modify a user account.


```
usermod -aG groupname username
```

31. **tar**: Extract files from an archive.


```
tar -xvf archive.tar.gz
```

32. **scp**: Secure copy files between hosts.


```
scp user@source:/path/to/file user@destination:/path/to/destination
```

33. **awk**: Perform text pattern scanning and processing.


```
awk '{print NF}' filename
```

34. **sed**: Stream editor for filtering and transforming text.


```
sed -n '1,10p' filename
```

35. **grep**: Search for patterns in files.


```
grep -r "pattern" /path/to/search
```

36. **mount**: Mount a file system.


```
mount /dev/sdX1 /mnt
```

37. **umount**: Unmount a file system.


```
umount /mnt
```

38. **lsblk**: List information about all available block devices.


```
lsblk
```

39. **df**: Display free disk space.


Linux Cheat sheet
```
df -h
```

40. **date**: Display the current date and time.


```
date
```

41. **cal**: Display a calendar.


```
cal
```

42. **uptime**: Display how long the system has been running.
```
uptime
```

43. **history**: Display the command history.


```
history
```

44. **file**: Determine file type.


```
file filename
```

45. **curl**: Transfer data with URLs.


```
curl https://example.com
```

46. **wget**: Non-interactive network downloader.


```
wget https://example.com/file.txt
```

47. **find**: Search for files and directories.


```
find /path/to/search -type f -name "*.txt"
```

48. **sort**: Sort lines of text files.


```
sort filename
```

49. **uniq**: Report or omit repeated lines in a file.


```
Linux Cheat sheet
uniq filename
```

50. **nmcli**: Command-line client for NetworkManager.


```
nmcli connection show

51. **crontab**: Schedule tasks to run at fixed times.


```
crontab -e
```

52. **at**: Execute commands at a specified time.


```
at now + 1 hour
```

53. **du**: Display disk usage statistics for a directory.


```
du -h /path/to/directory
```

54. **df**: Display file system disk space usage.


```
df -h
```

55. **journalctl**: Query and display messages from the journal.


```
journalctl
```

56. **lshw**: List hardware information.


```
lshw
```

57. **lsusb**: List USB devices.


```
lsusb
```

58. **lspci**: List PCI devices.


```
lspci
```

59. **uptime**: Show how long the system has been running.
```
uptime
```
Linux Cheat sheet
60. **who**: Display information about logged-in users.
```
who
```

61. **wc**: Count lines, words, and characters in a file.


```
wc filename
```

62. **watch**: Execute a program periodically and display the result.


```
watch -n 1 command
```

63. **chroot**: Run a command or interactive shell with a different root directory.
```
chroot /path/to/new/root command
```

64. **ldd**: Print shared library dependencies.


```
ldd /path/to/executable
```

65. **nm**: List symbols from object files.


```
nm /path/to/object/file
```

66. **free**: Display amount of free and used memory in the system.
```
free -h
```

67. **killall**: Kill processes by name.


```
killall process_name
```

68. **renice**: Alter priority of running processes.


```
renice +5 PID
```

69. **ulimit**: Control user-level resource limits.


```
ulimit -n
```
Linux Cheat sheet
70. **lscpu**: Display information about CPU architecture.
```
lscpu
```

71. **echo**: Display a message or value.


```
echo "Hello, World!"
```

72. **ssh-keygen**: Generate an SSH key pair.


```
ssh-keygen -t rsa -b 2048
```

73. **scp**: Copy files securely between hosts on a network.


```
scp user@source:/path/to/file user@destination:/path/to/destination
```

74. **sftp**: Securely transfer files over SSH.


```
sftp user@hostname
```

75. **chmod**: Change file permissions.


```
chmod 644 filename
```

76. **chown**: Change file ownership.


```
chown user:group filename
```

77. **find**: Search for files and directories.


```
find /path/to/search -name "*.txt"
```

78. **xargs**: Build and execute command lines from standard input.
```
find /path/to/search -type f | xargs rm
```

79. **tail**: Display the last part of a file.


```
tail -n 10 filename
```

80. **head**: Display the first part of a file.


Linux Cheat sheet
```
head -n 10 filename
```

You might also like