Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
mlachowicz authored Oct 30, 2023
1 parent bd05a1e commit 4c42a03
Showing 1 changed file with 43 additions and 19 deletions.
62 changes: 43 additions & 19 deletions _posts/2023-10-30-linux-cheat-sheet.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ Linux System Administration

1. Introduction

## Distributions
# Distributions

Selected systems from the Debian family:
- Debian
Expand Down Expand Up @@ -322,59 +322,83 @@ nano os.txt

## Command line editing with a stream editor

Replacing text in a file using 'sed':
Replacing text in a file using 'sed'
```
echo "Hello, World!" > greeting.txt
sed -i 's/Hello/Hi/' greeting.txt
```

5. Working in the shell

* Command substitution
## Command substitution

Running a command and using its output as an argument for another command:
Running a command and using its output as an argument for another command
```
ls -l /bin/$(which nano)
```

* Variables
## Variables

Defining and displaying a variable:
Defining and displaying a variable
```
MY_VAR="Hello, Shell!"
echo $MY_VAR
```

* Init files
## Init files

Displaying the contents of the '.bashrc' file:
Displaying the contents of the ```.bashrc``` file
```
cat ~/.bashrc
```

Editing the '.bashrc' file:
Editing the ```.bashrc``` file
```
nano ~/.bashrc
```

* Stream redirection
## Stream redirection

Redirecting the output of a command to a file:
Redirecting the output of a command to a file
```
ls -l > list.txt
```

Redirecting the output of a command and appending it to a file:
Redirecting the output of a command and appending it to a file
```
ls -l >> list.txt
```

Redirecting the input of a command from a file:
Redirecting the input of a command from a file
```
cat < os.txt
```

6. File system permissions

* Understanding permissions and ownership
## Understanding permissions and ownership

Listing file permissions:
Listing file permissions
```
ls -l os.txt
```

Displaying the owner of a file:
Displaying the owner of a file
```
ls -l os.txt
```

* Absolute and symbolic mode
## Absolute and symbolic mode

Changing file permissions using absolute mode:
Changing file permissions using absolute mode
```
chmod 644 os.txt
```

Changing file permissions using symbolic mode:
Changing file permissions using symbolic mode
```
chmod u+x os.txt
```

* Changing permissions

Expand Down

0 comments on commit 4c42a03

Please sign in to comment.