0% found this document useful (0 votes)
13 views5 pages

Essential Linux Commands Guide

This document provides commands for basic Linux system information and administration. Some key commands include: - uname - to view kernel information - hostname - to view or temporarily set the system name - uptime - to view system uptime and load averages - free - to view memory usage - lsblk - to view block devices and partitions - find - to search for files and directories on the system

Uploaded by

subodh
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views5 pages

Essential Linux Commands Guide

This document provides commands for basic Linux system information and administration. Some key commands include: - uname - to view kernel information - hostname - to view or temporarily set the system name - uptime - to view system uptime and load averages - free - to view memory usage - lsblk - to view block devices and partitions - find - to search for files and directories on the system

Uploaded by

subodh
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Class 4

Basic command

27. check current user name

Logname or whoami

28. see the kernel name

Uname

29. see the kernel version

Uname -r

30. see the kernel release date

Uname -v

31. see the hostname

Hostname

32. change the name temporary

Hostname cloudserver

Bash

33. change the name permanent

Nmtui = network manager terminal user interface

Bash

34. see the hardware platform

32 bit = x86 (max - 4GB) , 64 bit =x86_64 (max 16 TB)

Uname -i

35 see the processor bit

Uname -p

36. see the OS name

Uname -o or cat /etc/redhat-release

37. see the all info

Uname -a

38. see the date and time

Date or timedatectl

39. change the date and time

Date -s “30 may 2025 3:30:45”

40. open the calculator


Bc =basic calculator

Ctrl+d

41. see the calculator version

Bc -v

42. see the server uptime and load

Uptime

03:33:02 up 40 min, 1 user, load average: 0.01, 0.01, 0.01

03:33:02 = time

up 40 min, = uptime

1 user,

load average: 0.01, 0.02, 0.05 = 0.01 = last 1 min load , 0.02 = last 10 min load , 0.05 = last 15 min load

43. see the command file

Which mkdir

44. help command

Man mkdir or mkdir --help

45. see the full of file and directory

Ls -l or ll (long listing)

drwxr-xr-x. 2 root root 6 May 30 03:37 ducat

d = directory , - = file , l =softlink , c = character device (processing device = cpu , RAM ) , b =block device (hard
disk , PD , CD , DVD)

rwxr-xr-x = permission

. = + = acl

2 = sub folder

Root = owner

root = group

6 = size in byte

May 30 03:37 = creation date and time

Ducat = name

[Link] the size of file / folder

Du -sh name

47. see the current month and year calendar

Cal
48. see the whole year calendar

Cal 2050

49. see the specific month and year calendar

Cal 4 2000

50. shutdown the server

Init 0 or shutdown -p now or halt -p or poweroff or telinit 0

51. restart the server

Init 6 or reboot or shutdown -r

52. see the data slowly

Cat /etc/passwd | less

53. see the data slowly

Cat /etc/passwd | more

Less down , up

More = down

54. catch the specific word in a output

Grep root /etc/passwd or cat /etc/passwd | grep root

55. see the data inverse

Tac test

56. see the 10 line from of a file from top

Head /etc/passwd

57. see the 5 line from top

Head -n 5 /etc/passwd

58. see the 10 line from bottom

Tail /etc/passwd

59. see the 4 line from bottom

Tail -n 4 /etc/passwd

60. see the last line of file

Tail -f /etc/passwd

61. see the RAM info

Free -h

62. see the CPU

Lscpu
63. see the harddisk and partition

Lsblk (list block)

64. search the file and folder

Find / -name passwd

[Link] only file

Find / -name passwd -type f

66. search only directory

Find / -name passwd -type d

67. ignore the case sensitivity

Find / -iname passwd

68. search empty data

Find / -empty

69. search the data from extension

Find / -name “*.mp3”

70. search exact 10 M data

Find / -size 10M

71. search less then 10M

Find / -size -10M

72. search more then 10M

Find / -size +10M

73. search modified data with in 20 min

Find / -mmin 20

Find / -mmin -20

Find / -mmin +20

74. modified in 4 days

Find / -mtime 4

75. see the shutdown and restart time

Last -x

76. see the restart time

last

Common questions

Powered by AI

The `lsblk` command is used to list all available block devices on the system without showing RAM disks. It provides detailed information about the hard disk drives and their partitions, including device name, major and minor device numbers, size, and mount points .

Two methods to read large data files slowly in the terminal are using `cat /etc/passwd | less` and `cat /etc/passwd | more`. The `less` command allows navigation back and forth within the file, providing more flexible browsing, whereas `more` only allows forward navigation through the file .

To modify the system date and time, you use the `date` command with the `-s` option followed by the new date and time formatted as "DD MMM YYYY HH:MM:SS". For example, `date -s "30 May 2025 3:30:45"` sets the date and time to 3:30:45 AM on May 30, 2025 .

To temporarily change the hostname of a server, you use the command `hostname newname`, where `newname` is the desired temporary hostname. This change will only last until the next system reboot .

The `find` command can perform a case-insensitive search using the `-iname` option instead of `-name`. This allows the command to match files irrespective of case in their names, which is useful when users may not remember the exact casing of file or directory names, ensuring that all possible matches are found .

To permanently change the hostname in a Linux system, you can use the `nmtui` command, which stands for Network Manager Text User Interface. It allows you to modify system network settings including the hostname, and the changes persist through reboots .

The `tail` command outputs the last part of files. By default, it shows the last 10 lines of each file. To target a specific number of lines, the `-n` option is used followed by the desired number of lines, e.g., `tail -n 4 /etc/passwd` displays the last 4 lines of the `/etc/passwd` file .

The command to view the system's server uptime and the load averages is `uptime`. It displays the current time, how long the system has been running, the number of users currently logged on, and the system load averages for the past 1, 5, and 15 minutes .

To check the current system's kernel name, you use the command `uname`. To find the kernel version, you append the `-r` option, resulting in `uname -r` to obtain detailed kernel version information .

The hardware platform of a Linux system can be checked using the command `uname -i`. This command will output `x86` for a 32-bit architecture and `x86_64` for a 64-bit architecture .

You might also like