Skip to content

Commit

Permalink
Merge pull request #20 from neuroinformatics-unit/add-linux-commands
Browse files Browse the repository at this point in the history
  • Loading branch information
IgorTatarnikov authored Sep 30, 2024
2 parents 4f92446 + 667f4e9 commit 7cc3cfa
Show file tree
Hide file tree
Showing 3 changed files with 81 additions and 3 deletions.
2 changes: 2 additions & 0 deletions index.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,8 @@ Source: [High Performance Python](https://learning.oreilly.com/library/view/high
* If data doesn't fit in memory make sure it's on fast storage (local)
:::

{{< include slides/linux_commands.qmd >}}

## Introduction to High Performance Computing (HPC) {.smaller}
* Lots of meanings
* Often just a system with many machines (nodes) linked together with some/all of:
Expand Down
3 changes: 0 additions & 3 deletions slides/extra_slide.qmd

This file was deleted.

79 changes: 79 additions & 0 deletions slides/linux_commands.qmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
## `cd`: Navigate Directories {.smaller}
- `cd [directory]` -- Changes the current working directory to the specified directory.
- `cd ..` -- Move up one directory level.
- `cd /path/to/directory` -- Go to a specific path.
- `cd ~` or `cd` -- Go to the home directory.
- `cd /` -- Go to the root directory.

## `ls`: List Directory Contents {.smaller}
- `ls` -- Lists files and directories in the current working directory.
- `ls -l` -- Displays detailed information about each file (permissions, owner, size, etc.).
- `ls -a` -- Shows all files, including hidden files (files starting with a dot).
- `ls -h` -- Displays sizes in human-readable format (e.g., KB, MB).
- `ls -lah` -- Combines the above options.


## `mkdir`: Make Directory {.smaller}
- `mkdir [directory_name]` -- Creates a new directory with the specified name.
- `mkdir -p /path/to/dir` to create nested directories.


## `rmdir` and `rm`: Remove Directories and Files {.smaller}
- `rm [file] `-- Removes a file.
- `rmdir [directory]` -- Removes an empty directory.
- `rm -r [directory]` - Removes a directory and its contents recursively.
- `rm -f [file]` - Removes to force remove a file (no undo be careful!).


## `mv` and `cp`: Move, Rename and Copy {.smaller}
- `cp [source] [destination]` -- Copies a file or directory to the destination.
- `mv [source] [destination]` -- Moves a file or directory to the destination.
- `mv` can also be used to rename a file or directory if the source and destination directories match.

```{.bash}
cp file.txt /new/location/
mv file.txt /new/location/
mv old_name.txt new_name.txt
```

## Input and Output {.smaller}
- `echo [text]` -- Displays text or outputs text to a file.
- `echo $ENV_VAR` -- Displays the value of an environment variable.
- `touch [filename]` -- Creates an empty file or updates the timestamp of an existing file.
- `>` -- Redirects output to a file.
- `>>` -- Appends output to a file.

```{.bash}
echo "Hello, Linux!"
touch file.txt
echo "Hello, Linux!" > file.txt
echo $HOME >> file.txt
```

## `watch`: Monitor Command Output {.smaller}
- `watch [command]` -- Repeatedly runs a command at intervals and displays the result.
- Use `watch -n [seconds] [command]` to change the interval.

```{.bash}
watch -n 0.5 nvidia-smi
```

## man and help: Get Help {.smaller}
- `man [command]` -- Opens the manual page for a command.
- `help [command]` -- Provides a short description of built-in commands.

```{.bash}
man ls
help cd
```

## `|`: Pipes!{.smaller}
Description:

- `|` -- Pipes the output of one command as input to another.
- Useful for chaining commands together to perform complex operations.

```{.bash}
ls | grep ".txt"
cat large_log_file.log | grep "ERROR" | less
```

0 comments on commit 7cc3cfa

Please sign in to comment.