[go: up one dir, main page]

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

Linux Command Documentation

This document provides a comprehensive overview of various Linux commands, detailing their descriptions and usage. Key commands include `uptime`, `free -m`, `df -h`, and file manipulation commands like `echo` and `cat`. Additionally, it covers error handling and searching commands such as `find` and `locate`.

Uploaded by

mawociy157
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)
5 views6 pages

Linux Command Documentation

This document provides a comprehensive overview of various Linux commands, detailing their descriptions and usage. Key commands include `uptime`, `free -m`, `df -h`, and file manipulation commands like `echo` and `cat`. Additionally, it covers error handling and searching commands such as `find` and `locate`.

Uploaded by

mawociy157
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
You are on page 1/ 6

Linux Command Documentation

#### **1. `uptime`**

- **Description**: Displays how long the system has been running, the number of users currently
logged in, and the system load averages for the past 1, 5, and 15 minutes.

- **Usage**: `uptime`

#### **2. `free -m`**

- **Description**: Displays the amount of free and used memory in the system in megabytes (`-m`
option).

- **Usage**: `free -m`

#### **3. `df -h`**

- **Description**: Displays disk space usage of all mounted filesystems in a human-readable format
(`-h` option).

- **Usage**: `df -h`

#### **4. `echo "Good Morning"`**

- **Description**: Prints the text "Good Morning" to the terminal.

- **Usage**: `echo "Good Morning"`

#### **5. `echo "##############################################" > /tmp/sysinfo.txt`**

- **Description**: Writes a line of `#` symbols to the file `/tmp/sysinfo.txt`, overwriting any existing
content.

- **Usage**: `echo "##############################################" > /tmp/sysinfo.txt`

#### **6. `date > /tmp/sysinfo.txt`**

- **Description**: Writes the current date and time to the file `/tmp/sysinfo.txt`, overwriting any
existing content.

- **Usage**: `date > /tmp/sysinfo.txt`

#### **7. `echo "##################################" >> /tmp/sysinfo.txt`**

- **Description**: Appends a line of `#` symbols to the file `/tmp/sysinfo.txt`.


- **Usage**: `echo "##################################" >> /tmp/sysinfo.txt`

#### **8. `cat /tmp/sysinfo.txt`**

- **Description**: Displays the contents of the file `/tmp/sysinfo.txt`.

- **Usage**: `cat /tmp/sysinfo.txt`

#### **9. `clear`**

- **Description**: Clears the terminal screen.

- **Usage**: `clear`

#### **10. `yum install vim -y > /dev/null`**

- **Description**: Installs the `vim` package using the `yum` package manager. The `-y` flag
automatically answers "yes" to prompts, and `> /dev/null` suppresses the output.

- **Usage**: `yum install vim -y > /dev/null`

#### **11. `cat /dev/null`**

- **Description**: Displays the contents of `/dev/null`, which is an empty file. This command
produces no output.

- **Usage**: `cat /dev/null`

#### **12. `cat /dev/null > /tmp/sysinfo.txt`**

- **Description**: Empties the contents of the file `/tmp/sysinfo.txt` by redirecting the empty
output of `/dev/null` to it.

- **Usage**: `cat /dev/null > /tmp/sysinfo.txt`

#### **13. `freeee -m > /dev/null`**

- **Description**: Attempts to run the non-existent command `freeee` and redirects its output to
`/dev/null`. This will result in an error.

- **Usage**: `freeee -m > /dev/null`

#### **14. `freeee -m 2>> /tmp/error.log`**

- **Description**: Attempts to run the non-existent command `freeee` and appends the error
message to the file `/tmp/error.log`.
- **Usage**: `freeee -m 2>> /tmp/error.log`

#### **15. `cat /tmp/error.log`**

- **Description**: Displays the contents of the file `/tmp/error.log`.

- **Usage**: `cat /tmp/error.log`

#### **16. `free -m 1>> /tmp/error.log`**

- **Description**: Appends the output of the `free -m` command to the file `/tmp/error.log`.

- **Usage**: `free -m 1>> /tmp/error.log`

#### **17. `free -m &>> /tmp/error.log`**

- **Description**: Appends both the standard output and error output of the `free -m` command to
the file `/tmp/error.log`.

- **Usage**: `free -m &>> /tmp/error.log`

#### **18. `freesdsd -m &>> /tmp/error.log`**

- **Description**: Attempts to run the non-existent command `freesdsd` and appends the error
message to the file `/tmp/error.log`.

- **Usage**: `freesdsd -m &>> /tmp/error.log`

#### **19. `cd /var/log/`**

- **Description**: Changes the current directory to `/var/log/`.

- **Usage**: `cd /var/log/`

#### **20. `ls`**

- **Description**: Lists the contents of the current directory.

- **Usage**: `ls`

#### **21. `wc -l /etc/passwd`**

- **Description**: Counts the number of lines in the file `/etc/passwd`.

- **Usage**: `wc -l /etc/passwd`


#### **22. `wc -l < /etc/passwd`**

- **Description**: Counts the number of lines in the file `/etc/passwd` using input redirection.

- **Usage**: `wc -l < /etc/passwd`

#### **23. `ls | wc -l`**

- **Description**: Lists the contents of the current directory and counts the number of lines (i.e.,
the number of files and directories).

- **Usage**: `ls | wc -l`

#### **24. `ls | grep host`**

- **Description**: Lists the contents of the current directory and filters the output to show only
entries containing the word "host".

- **Usage**: `ls | grep host`

#### **25. `tail /var/log/messages | grep -i vagrant`**

- **Description**: Displays the last 10 lines of the file `/var/log/messages` and filters the output to
show only lines containing the word "vagrant" (case-insensitive).

- **Usage**: `tail /var/log/messages | grep -i vagrant`

#### **26. `tail -20 /var/log/messages | grep -i vagrant`**

- **Description**: Displays the last 20 lines of the file `/var/log/messages` and filters the output to
show only lines containing the word "vagrant" (case-insensitive).

- **Usage**: `tail -20 /var/log/messages | grep -i vagrant`

#### **27. `free -m | grep Mem`**

- **Description**: Displays memory usage information and filters the output to show only the line
containing "Mem".

- **Usage**: `free -m | grep Mem`

#### **28. `ls -l | tail`**

- **Description**: Lists the contents of the current directory in long format and displays the last 10
lines of the output.

- **Usage**: `ls -l | tail`


#### **29. `ls -l | head`**

- **Description**: Lists the contents of the current directory in long format and displays the first 10
lines of the output.

- **Usage**: `ls -l | head`

#### **30. `find /etc -name host*`**

- **Description**: Searches the `/etc` directory for files and directories whose names start with
"host".

- **Usage**: `find /etc -name host*`

#### **31. `find / -name host*`**

- **Description**: Searches the entire filesystem for files and directories whose names start with
"host".

- **Usage**: `find / -name host*`

#### **32. `locate`**

- **Description**: Searches for files and directories in a pre-built database. Requires the `mlocate`
package to be installed.

- **Usage**: `locate <pattern>`

#### **33. `yum install mlocate -y`**

- **Description**: Installs the `mlocate` package using the `yum` package manager. The `-y` flag
automatically answers "yes" to prompts.

- **Usage**: `yum install mlocate -y`

#### **34. `updatedb`**

- **Description**: Updates the database used by the `locate` command.

- **Usage**: `updatedb`

#### **35. `locate host`**

- **Description**: Searches for files and directories containing the word "host" in their names using
the `locate` command.
- **Usage**: `locate host`

---

This documentation covers all the unique commands from the provided list. Let me know if you need
further clarification or additional details!

You might also like