Skip to content

Commit

Permalink
...
Browse files Browse the repository at this point in the history
  • Loading branch information
wmmihaa committed Jul 23, 2024
1 parent 48abb91 commit 6ebd696
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 17 deletions.
2 changes: 1 addition & 1 deletion assets/index.json

Large diffs are not rendered by default.

36 changes: 20 additions & 16 deletions nav/_quickreference/common-commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,28 @@ description: "Here is a list of commonly used Linux terminal commands"
categories: quickreference
order: 51
---

:star: = Personal favorites

### Favorite Linux commands
* `cd [directory]` **Change directory**
*This command can also be used double dots to go back one level `cd ..` or with dash `cd -` to go back to previous directory. `cd ~` to get to HOME directory and `cd /` to get to root directory.*
* `mkdir [directory]` **Make directory**
* `CTRL+l` **Clear screen**
*`CTRL+r` **Find a previous command**
* `cd [directory]` - *Change directory.
This command can also be used double dots to go back one level `cd ..` or with dash `cd -` to go back to previous directory. `cd ~` or `cd ` to get to HOME directory and `cd /` to get to root directory.*
* `mkdir [directory]` -*Make directory*
* `rm [file | directory]` removes a file of directory. If the directory is not empty. use the recursive flag `-r`
* `CTRL+l` -*Clear screen*
*`CTRL+r` -*Find a previous command*
*Hit `CTRL+r` and start typing to find a command you have used before*
* `sudo [command]` **Run command as root**
* `sudo su` **Change user to `root`**
* `find -name [name of file]` **Find a file by name**
* `cat [file name]` **View content of file**
* `df -h` **shows available and used disk space on the Linux system**
* `chmod +x [file name]` **Makes file executable**
* `grep` is used to filter output such as `df -h | grep udev` returns only one row from the `df` command
* `asw` spits an input into an array. For instance `df -h | grep udev | awk '{print $2}'` returns only the second column.
* `whoami` -*Show the current user*
* `sudo [command]` -*Run command as root*
* `sudo su` -*Change user to `root`*
* `find -name [name of file]` -*Find a file by name*
* `grep -R ./ -e "[seach pattern]"` -*find files containing a word or pattern* :star:
* `cat [file name]` -*View content of file*
* `df -h` -*shows available and used disk space on the Linux system*
* `chmod +x [file name]` -*Makes file executable*
* `grep` - is used to filter output such as `df -h | grep udev` returns only one row from the `df` command
* `asw` - spits an input into an array. For instance `df -h | grep udev | awk '{print $2}'` returns only the second column.

**grep and awk** sample
**grep and awk** sample :star:
```
$ df -h
Filesystem Size Used Avail Use% Mounted on
Expand Down Expand Up @@ -74,7 +78,7 @@ $ df | grep udev | awk '{print $2}'
### Favorite **journalctl** commands
`journalctl` is also part of the `systemd` suite and helps you view logfile in real-time.

`journalctl -u [service] -n [number of previous lines] -f`. E.g.
`journalctl -u [service] -n [number of previous lines] -f` :star:. E.g.
```
journalctl -u microservicebus-node -n 100 -f
```
Expand Down

0 comments on commit 6ebd696

Please sign in to comment.