DWTutorials:Linux Basics for Beginners: Difference between revisions
Created page with "{{DISPLAYTITLE:DWShells Linux Basics for Beginners}} center|frameless|1000px|alt=DWShells Linux Basics for Beginners course banner = Linux Basics for Beginners = '''Debian Shell Course for DWShells''' {| class="wikitable" style="width:100%;" |- ! Course level | Complete beginner ! Suggested time | 12–16 hours |- ! Platform | Debian GNU/Linux ! Access | DWShells account through SSH |- ! Permissions | Normal user account; no ro..." |
No edit summary |
||
| Line 2,038: | Line 2,038: | ||
---- | ---- | ||
'' | ''DWTutorials Linux Basics for Beginners — © 2026 DarkWorld Network. All rights reserved.'' | ||
[[Category:DWTutorials]] | |||
[[Category:DWShells]] | [[Category:DWShells]] | ||
[[Category:Linux]] | [[Category:Linux]] | ||
[[Category:Debian]] | [[Category:Debian]] | ||
[[Category:Beginner courses]] | [[Category:Beginner courses]] | ||
Revision as of 02:17, 22 July 2026

Linux Basics for Beginners
Debian Shell Course for DWShells
| Course level | Complete beginner | Suggested time | 12–16 hours |
|---|---|---|---|
| Platform | Debian GNU/Linux | Access | DWShells account through SSH |
| Permissions | Normal user account; no root access required | Course version | 1.0 — July 2026 |
This course teaches the Linux command line from the beginning. You will learn by running safe commands in your own DWShells home directory. By the end, you will be able to navigate Linux, manage files, understand permissions, combine commands, monitor your own processes, transfer files securely, and write a small Bash script.
Copyright: © 2026 DarkWorld Network. All rights reserved.
Before you begin
What you need
- An active DWShells account.
- Your DWShells username, password or SSH key, hostname, and SSH port.
- An SSH program:
- Windows 10/11: Windows Terminal, PowerShell, or PuTTY.
- Linux: a terminal application.
- macOS: Terminal.
- Android/iOS: a reputable SSH client.
- About one hour per lesson.
Examples use the hostname shells.darkworld.network. If your welcome email gives a different hostname or port, always use the details in that email.
How to read command examples
When you see:
$ pwd
/home/free/alex
the dollar sign is the shell prompt. Type only pwd; do not type the dollar sign. Lines after the command show example output. Your username, hostname, dates, file sizes, and other details will be different.
Safety rules
| Rule | Reason |
|---|---|
Work inside $HOME unless a lesson clearly says otherwise.
|
This is your personal directory and the safest place to practise. |
| Read a command before pressing Enter. | Linux assumes that you mean what you type. |
| Do not copy unknown commands from websites or strangers. | A short command can steal data, misuse the server, or delete files. |
Never practise with root, sudo, su, or system files.
|
DWShells learners do not need administrator access. |
| Never use network scanners, miners, attack tools, spam tools, or prohibited long-running services. | Follow the DWShells Acceptable Use Policy and protect other users. |
| Ask DWShells staff if you are unsure. | It is better to check first than to damage data or violate policy. |
Course workspace
Create one directory for all labs:
mkdir -p "$HOME/linux-course"
cd "$HOME/linux-course"
pwd
Expected final line:
/your/home/path/linux-course
The exact home path may be /home/free/USERNAME, /home/support/USERNAME, or another path assigned by DWShells. Use $HOME so your commands work in every case.

Lesson 1 — Meet Linux and connect to DWShells
Goal: Understand the basic vocabulary, connect securely, run simple commands, and leave the session correctly.
1.1 What is Linux?
Linux is the core, or kernel, that manages the computer's CPU, memory, storage, devices, and processes. A complete operating system combines the Linux kernel with programs and tools.
Debian is the Linux distribution used by DWShells. Debian is known for stability, security, and careful software packaging.
| Term | Simple meaning |
|---|---|
| Linux | The kernel that manages the system. |
| Debian | The Linux distribution running on the server. |
| Terminal | The window or application where you type commands. |
| Shell | The program that reads and runs your commands. This course uses Bash examples. |
| SSH | Secure Shell: the encrypted method used to connect to DWShells. |
| Command | An instruction given to the shell. |
1.2 Connect with SSH
From Windows Terminal, PowerShell, Linux, or macOS, run this on your own computer:
ssh USERNAME@shells.darkworld.network
If DWShells uses a custom port:
ssh -p PORT_NUMBER USERNAME@shells.darkworld.network
Replace USERNAME and PORT_NUMBER with the details in your welcome email.
The first connection may display a server host-key fingerprint and ask whether you trust it. Compare it with the fingerprint published by DWShells or ask staff to verify it. Do not accept an unexpected or changed fingerprint without checking.
When asked for a password, type it and press Enter. The terminal normally shows no dots and no stars while you type a Linux password. This is normal.
1.3 Understand the prompt
A prompt may look like:
alex@dwshells:~$
alex— your username.dwshells— the server hostname.~— your home directory.$— a normal user's prompt. A#prompt usually represents an administrator and is not used in this course.

1.4 Run your first commands
Run one line at a time:
whoami
hostname
pwd
date
echo "Hello from DWShells"
| Command | Purpose |
|---|---|
whoami
|
Shows the current username. |
hostname
|
Shows the server's name. |
pwd
|
Prints the working directory—your current location. |
date
|
Shows the server's current date and time. |
echo
|
Prints text or a variable's value. |
Linux commands and filenames are case-sensitive. pwd, PWD, and Pwd are not the same.
1.5 Essential keyboard controls
| Key | Action |
|---|---|
| Up / Down arrows | Move through recently entered commands. |
| Tab | Complete a command or filename. Press twice to show possibilities. |
| Ctrl+C | Interrupt the command currently running. |
| Ctrl+L | Clear the visible terminal screen without deleting history. |
| Ctrl+D | Send end-of-file; at an empty prompt it logs out. |
To leave DWShells normally:
exit
Lesson 1 lab
- Connect to DWShells.
- Display your username, hostname, home directory, and the current date.
- Print the sentence
I am learning Debian Linux. - Use the Up arrow to recall your previous command.
- Log out using
exit, then connect again.
Lesson 1 review
- What is the difference between a terminal and a shell?
- What secure protocol connects you to DWShells?
- Why does the password appear invisible while you type?
- Which command prints your current directory?
- Which key combination stops a running command?
Lesson 2 — Navigate the filesystem
Goal: List directory contents and move confidently using absolute paths, relative paths, and shortcuts.
2.1 The filesystem is a tree
Linux uses one directory tree beginning at /, called the root directory. This is different from the root administrator account.

Important locations:
| Path | Purpose | Beginner guidance |
|---|---|---|
/
|
Top of the entire filesystem. | Browse only; do not try to modify it. |
/home
|
Contains user home directories. | Your own home is your normal workspace. |
/etc
|
System configuration. | Usually readable but not writable by normal users. |
/var
|
Logs, cache, mail, and changing system data. | Mostly managed by services and administrators. |
/tmp
|
Temporary files. | Files may be deleted automatically; never store valuables here. |
/usr
|
Programs, libraries, and shared read-only data. | Useful to understand, but not your workspace. |
2.2 List files with ls
ls
ls -l
ls -a
ls -lah
Common options:
-l— long format with permissions, owner, size, and date.-a— include hidden names beginning with a dot.-h— display sizes in a human-readable form such as KiB or MiB.
Options can be combined: ls -l -a -h and ls -lah are equivalent.
List another directory without moving there:
ls -lah /etc
ls -lah "$HOME"
2.3 Move with cd
cd "$HOME"
cd /
cd /etc
cd ..
cd -
cd ~
| Path or command | Meaning |
|---|---|
cd /etc
|
Move to the absolute path /etc.
|
cd ..
|
Move to the parent directory. |
cd .
|
Stay in the current directory. A single dot means “here.” |
cd -
|
Return to the previous directory. |
cd or cd ~
|
Return to your home directory. |
An absolute path begins with /, such as /etc/hosts. A relative path begins from your current directory, such as lesson-02/notes.txt.
2.4 Hidden files
Names beginning with a dot are hidden from a normal ls listing:
ls -la "$HOME"
Configuration files such as .bashrc and directories such as .ssh are hidden to reduce clutter, not to provide security.
Lesson 2 lab
Run each task and use pwd after every cd:
- Go to your home directory.
- Go to the root directory.
- List the root directory in long, human-readable format.
- Go to
/etc. - Return to the previous directory using
cd -. - Return home using the shortest command you know.
- List all hidden names in your home directory.
Lesson 2 review
- What is the difference between
/and/root? - What does
~represent? - Which
lsoption shows hidden files? - Is
/etc/hostsan absolute or relative path? - What do
.and..mean?
Lesson 3 — Create, copy, move, and remove files
Goal: Organize data in your course workspace and delete items safely.
3.1 Create directories and files
cd "$HOME/linux-course"
mkdir lesson-03
cd lesson-03
mkdir documents backups
touch notes.txt
ls -lah
mkdircreates a directory.touchcreates an empty file if it does not exist, or updates its timestamp if it does.mkdir -pcreates missing parent directories and does not complain if they already exist.
Example:
mkdir -p project/docs/drafts
3.2 Copy files and directories
cp notes.txt notes-copy.txt
cp notes.txt documents/
cp -i notes.txt documents/notes.txt
cp -r documents backups/
cp SOURCE DESTINATIONcopies a file.-rcopies a directory and its contents recursively.-iasks before overwriting an existing destination.-vdisplays what is being copied.
For an important copy, check the destination:
ls -lah documents backups
3.3 Move and rename
The same mv command moves and renames:
mv notes-copy.txt old-notes.txt
mv old-notes.txt documents/
mv -i notes.txt main-notes.txt
3.4 Remove safely
rm -i main-notes.txt
rm -i backups/documents/notes.txt
rmdir backups/documents
rmdir backups
rmremoves files.rmdirremoves an empty directory.rm -r DIRECTORYremoves a directory tree recursively.rm -fforces removal without a question. Beginners should avoid it.
Important: Shell deletion normally does not use a recycle bin. Always run pwd and ls first. Prefer rm -i while learning.
Never run destructive examples such as rm -rf on broad paths. Do not combine recursive deletion with /, ~, $HOME, unknown variables, or an unreviewed wildcard.
3.5 Wildcards in file operations
The shell expands patterns before running a command:
| Pattern | Meaning | Example |
|---|---|---|
*
|
Any number of characters. | ls *.txt
|
?
|
Exactly one character. | ls note?.txt
|
[abc]
|
One character from the brackets. | ls file[123].txt
|
Preview a wildcard with printf or ls before using it with cp, mv, or rm:
printf '%s\n' *.txt
Lesson 3 lab
Work only in $HOME/linux-course/lesson-03:
- Create directories named
practiceandpractice/archive. - Create empty files
one.txt,two.txt, andthree.log. - Copy the two
.txtfiles intopractice. - Rename
three.logtoactivity.log. - Copy
activity.logintopractice/archive. - List the complete result with
ls -lR. - Remove only
two.txtfrom the current directory using interactive mode.
Lesson 3 review
- Which command creates parent directories automatically?
- How do you copy a directory and its contents?
- Which command renames a file?
- Why should you use
rm -iwhile learning? - What does
*.txtmatch?
Lesson 4 — Read and edit text files
Goal: Inspect text safely, edit with Nano, and compare files.
4.1 Identify and display files
Create lesson data:
mkdir -p "$HOME/linux-course/lesson-04"
cd "$HOME/linux-course/lesson-04"
printf 'alpha\nbeta\ngamma\ndelta\nepsilon\n' > words.txt
Now inspect it:
file words.txt
cat words.txt
head -n 3 words.txt
tail -n 2 words.txt
wc -l words.txt
| Command | Use |
|---|---|
file NAME
|
Guess the file type. |
cat NAME
|
Display a short text file. |
less NAME
|
Read a long file one screen at a time. |
head -n N NAME
|
Show the first N lines. |
tail -n N NAME
|
Show the last N lines. |
wc
|
Count lines, words, or bytes. |
Inside less:
- Arrow keys or Page Up/Page Down — move.
/word— search forward.n— next match.q— quit.
Follow a file as new lines are added:
tail -f filename.log
Press Ctrl+C to stop following. Use this only on logs you are permitted to read.
4.2 Edit with Nano
Open a file:
nano notes.txt
Nano shows shortcuts at the bottom. The ^ character means Ctrl.
| Shortcut | Action |
|---|---|
| Ctrl+O | Write (save) the file. |
| Ctrl+X | Exit Nano. |
| Ctrl+W | Search. |
| Ctrl+K | Cut the current line. |
| Ctrl+U | Paste the cut line. |
| Alt+U | Undo, where supported. |
If Nano is not available, ask DWShells staff which editor is supported. Do not edit unfamiliar system configuration files while learning.
4.3 Write predictable text with printf
printf '%s\n' "DWShells Linux Course" "Lesson 4" > summary.txt
printf '%s\n' "Completed" >> summary.txt
cat summary.txt
The single > replaces a file's content. The double >> appends. Lesson 7 explains this in detail.
4.4 Compare files
cp words.txt words-copy.txt
printf '%s\n' "zeta" >> words-copy.txt
diff -u words.txt words-copy.txt
No output from diff means the files are identical.
Lesson 4 lab
- Create
$HOME/linux-course/lesson-04/profile.txt. - Use Nano to write your username, the course name, and three Linux commands you have learned.
- Save and exit.
- Display the first two lines with
head. - Display the last line with
tail. - Count the number of lines with
wc. - Copy the file, add one new line to the copy, and compare both files with
diff -u.
Lesson 4 review
- When is
lessbetter thancat? - How do you quit
less? - Which Nano shortcut saves a file?
- What is the difference between
headandtail? - What does no output from
diffnormally mean?
Lesson 5 — Find help and understand commands
Goal: Use built-in documentation instead of guessing.
5.1 Quick help
Most programs support:
ls --help
cp --help
grep --help
Because help can be long, send it to less:
ls --help | less
5.2 Manual pages
man ls
man cp
man chmod
Useful keys in man are the same as in less: / searches, n finds the next result, and q quits.
Search manual descriptions:
whatis ls
apropos "copy files"
man -k "search text"
apropos and man -k are equivalent. On a minimal server, the manual index or some pages may not be installed.
5.3 Learn what the shell will run
type cd
type ls
command -v bash
command -v nano
typecan identify an alias, function, shell builtin, or executable.command -vchecks whether a command is available and shows what will run.cdis normally a shell builtin because it must change the current shell's directory.
5.4 Command history
history
history | tail -n 20
History can contain sensitive data if you type passwords, tokens, or private URLs directly on the command line. Never put a password or API key in a command unless the tool provides a secure method.
To search previous commands interactively, press Ctrl+R and type part of a command. Press Ctrl+R again for an older match, Enter to run it, or Ctrl+C to cancel.
5.5 Read syntax notation
Manuals often use:
COMMAND [OPTION]... [FILE]...- Square brackets mean optional.
- Three dots mean an item can be repeated.
- A vertical list separated by
|means choose one item. - Uppercase words such as
FILEare placeholders, not literal text.
Lesson 5 lab
- Open the manual for
mkdir. - Search inside it for
parents. - Find the option that creates parent directories.
- Use
typeoncd,pwd, andls. - Use
command -vto check fornano,vim, andcurl. - Show only your last ten history entries.
Lesson 5 review
- What is the fastest common option for brief command help?
- Which command opens a manual page?
- Which key exits a manual page?
- What does
command -vtell you? - Why should secrets not appear in command history?
Lesson 6 — Understand permissions and ownership
Goal: Read permission strings and protect your own files.
6.1 Read a long listing
cd "$HOME/linux-course"
ls -ld .
ls -l
A long listing may look like:
-rwxr-x--- 1 alex support 812 Jul 22 10:30 report.sh
It contains:
- File type and permissions:
-rwxr-x--- - Link count:
1 - Owner:
alex - Group:
support - Size in bytes:
812 - Last modification time
- Filename:
report.sh

6.2 File types
The first character commonly means:
| Character | Type |
|---|---|
-
|
Regular file |
d
|
Directory |
l
|
Symbolic link |
6.3 Read, write, and execute
Permissions are shown for owner, group, and others.
| Permission | On a file | On a directory |
|---|---|---|
r — read
|
Read file contents. | List names in the directory, subject to other permissions. |
w — write
|
Modify the file. | Create, delete, or rename entries in the directory. |
x — execute
|
Run a program or script. | Enter/traverse the directory and access known names. |
Directory permissions are especially important: read and execute have different jobs.
6.4 Change permissions symbolically
Create a practice script:
mkdir -p "$HOME/linux-course/lesson-06"
cd "$HOME/linux-course/lesson-06"
printf '%s\n' '#!/bin/bash' 'echo "Permission test successful"' > test.sh
ls -l test.sh
chmod u+x test.sh
ls -l test.sh
./test.sh
Symbolic targets and operations:
uowner/user,ggroup,oothers,aall.+add,-remove,=set exactly.
Examples:
chmod u+x script.sh
chmod go-rwx private.txt
chmod u=rw,go= notes.txt
chmod g+r shared.txt
6.5 Numeric permissions
The values are:
- read = 4
- write = 2
- execute = 1
Add each set:
| Number | Permission | Common use |
|---|---|---|
| 7 | rwx
|
Full access |
| 6 | rw-
|
Read and write |
| 5 | r-x
|
Read and execute |
| 4 | r--
|
Read only |
| 0 | ---
|
No access |
Examples:
chmod 700 private-directory
chmod 600 private.txt
chmod 750 script.sh
chmod 640 shared-report.txt
Avoid chmod 777. It allows every local user to modify the item and is almost never the correct fix.
6.6 Ownership, groups, and umask
whoami
id
groups
umask
idshows your numeric user ID, group ID, and group memberships.chgrp GROUP FILEchanges a file's group only when you are permitted to use that group.chownchanges ownership and normally requires administrator privileges. It is not a learner exercise.umaskcontrols which permissions are removed from newly created files and directories.
For SSH files, secure permissions are normally:
chmod 700 "$HOME/.ssh"
chmod 600 "$HOME/.ssh/authorized_keys"
Run those commands only if the paths exist and belong to you.
Lesson 6 lab
In $HOME/linux-course/lesson-06:
- Create
private.txtand set it to owner read/write only. - Create
shared.txtand set it to owner read/write, group read, others none. - Create a directory
private-dirwith owner-only access. - Use
ls -landls -ldto verify all three. - Remove execute permission from
test.sh, try to run it directly, then restore execute permission. - Display your user and group memberships with
id.
Lesson 6 review
- What do the three permission groups represent?
- What is the numeric value of
r-x? - What does execute permission mean on a directory?
- Which command changes permissions?
- Why is
777unsafe?
Lesson 7 — Redirect output and build pipelines
Goal: Save command output, separate errors, and connect small tools with pipes.
7.1 Standard input, output, and error
Every command starts with three standard data streams:
| Stream | Number | Normal source or destination |
|---|---|---|
| Standard input (stdin) | 0 | Your keyboard |
| Standard output (stdout) | 1 | Your terminal |
| Standard error (stderr) | 2 | Your terminal |
Redirection changes where these streams go.
7.2 Replace or append a file
mkdir -p "$HOME/linux-course/lesson-07"
cd "$HOME/linux-course/lesson-07"
printf '%s\n' "first line" > output.txt
printf '%s\n' "second line" >> output.txt
cat output.txt
>creates a file or replaces all existing content.>>creates a file or appends to the end.
Always inspect an important filename before using >.
Save command output:
date > current-date.txt
ls -lah "$HOME" > home-listing.txt
7.3 Redirect errors
touch existing-file
ls existing-file missing-file > normal.txt 2> errors.txt
cat normal.txt
cat errors.txt
Combine normal output and errors:
ls existing-file missing-file > everything.txt 2>&1
Discard output only when you intentionally do not need it:
command -v nano > /dev/null 2>&1
echo "$?"
/dev/null discards data. The value $? is the previous command's exit status: 0 usually means success and a non-zero value means an error or another special result.
7.4 Pipes
A pipe | sends one command's standard output to the next command's standard input.

Create safe practice data:
printf '%s\n' \
"INFO login accepted" \
"ERROR invalid password" \
"INFO session opened" \
"ERROR disk quota warning" \
"INFO session closed" > activity.log
Now build pipelines:
cat activity.log | grep "ERROR"
grep "ERROR" activity.log | wc -l
sort activity.log
sort activity.log | uniq
grep "ERROR" activity.log is more direct than piping cat into grep, but both forms help demonstrate the data flow.
7.5 Useful filter commands
| Command | Purpose | Example |
|---|---|---|
grep
|
Keep lines matching a pattern. | grep -i "error" activity.log
|
sort
|
Sort lines. | sort names.txt
|
uniq
|
Remove or count adjacent duplicate lines. | uniq -c |
wc
|
Count lines, words, or bytes. | wc -l activity.log
|
cut
|
Select delimited fields. | cut -d: -f1 /etc/passwd
|
tr
|
Translate or delete characters. | tr 'a-z' 'A-Z' |
tee
|
Display and save output at the same time. | tee date.txt |
The /etc/passwd example displays local account names from a normally public system file. It does not reveal passwords; modern Linux stores password hashes elsewhere with restricted access.
Lesson 7 lab
- Create a file containing at least six lines, including three lines with the word
PASSand two withFAIL. - Display only
FAILlines, ignoring case. - Count the
PASSlines using a pipeline. - Save the sorted content to
sorted.txt. - Append the current date to
sorted.txt. - Run a command using a nonexistent filename and save its error to
error.txt. - Use
teeto display and savewhoami.
Lesson 7 review
- What is the difference between
>and>>? - Which number represents standard error?
- What does a pipe do?
- Why is
sortoften placed beforeuniq? - What does exit status zero usually mean?
Lesson 8 — Search, match, and quote safely
Goal: Locate files and text without scanning the whole server, and understand how the shell treats special characters.
8.1 Search text with grep
grep "ERROR" "$HOME/linux-course/lesson-07/activity.log"
grep -i "error" "$HOME/linux-course/lesson-07/activity.log"
grep -n "INFO" "$HOME/linux-course/lesson-07/activity.log"
grep -v "INFO" "$HOME/linux-course/lesson-07/activity.log"
Common options:
-i— ignore letter case.-n— show line numbers.-v— show non-matching lines.-r— search directories recursively.-l— show filenames containing a match.
Search only your course directory:
grep -Rin "linux" "$HOME/linux-course"
Avoid broad recursive searches from /. They are slow, generate permission errors, and consume shared server resources.
8.2 Find files by name and type
find "$HOME/linux-course" -type f -name "*.txt"
find "$HOME/linux-course" -type d -name "lesson-*"
find "$HOME/linux-course" -type f -size +1k
find "$HOME/linux-course" -type f -mtime -1
-type f— regular files.-type d— directories.-name— case-sensitive name pattern.-iname— case-insensitive name pattern.-size +1k— larger than 1 KiB.-mtime -1— modified within about the last day.
Keep the search starting point narrow. Search $HOME or a project directory, not the entire server.
8.3 Shell expansion and quoting
Before a command runs, Bash processes variables, wildcards, quotes, and substitutions.
course="Linux Basics"
printf '%s\n' "$course"
printf '%s\n' '$course'
Output:
Linux Basics $course
| Form | Behavior |
|---|---|
"double quotes"
|
Preserve spaces but expand variables and command substitutions. |
'single quotes'
|
Treat nearly everything literally. |
\
|
Escape the next special character outside single quotes. |
| Unquoted text | May be split at spaces and expanded as a wildcard. |
Correctly handle spaces in names:
mkdir -p "$HOME/linux-course/lesson 08"
touch "$HOME/linux-course/lesson 08/my notes.txt"
ls -l "$HOME/linux-course/lesson 08/my notes.txt"
Quoting variables is a vital habit:
file="$HOME/linux-course/lesson 08/my notes.txt"
cat "$file"
8.4 Command substitution
Command substitution places output inside another command:
today="$(date +%F)"
printf 'Today is %s\n' "$today"
The modern $(command) form is easier to read and nest than old backquote syntax.
8.5 Environment variables
printf '%s\n' "$HOME"
printf '%s\n' "$USER"
printf '%s\n' "$SHELL"
printf '%s\n' "$PATH"
env | sort | less
PATH is the list of directories Bash searches for commands. Do not add unsafe or world-writable directories to it.
Lesson 8 lab
- Find all
.txtfiles inside$HOME/linux-course. - Search those course files recursively for the word
DWShells, ignoring case. - Create a directory containing a space and a file containing a space.
- Store that file's full path in a variable and display it using correct quoting.
- Store the current date in
todayusing command substitution. - Print
Course date: YYYY-MM-DDusing that variable.
Lesson 8 review
- Why should a
findsearch start from a narrow directory? - What is the difference between
grep -iandgrep -v? - Do variables expand inside single quotes?
- Why should path variables normally be double-quoted?
- What does
$(date +%F)do?
Lesson 9 — Manage your processes and jobs
Goal: Inspect your own programs, use foreground and background jobs, and stop a process gracefully.
9.1 What is a process?
A process is a running instance of a program. Every process has a process ID, or PID, an owner, resource usage, and a state.
View your processes:
ps
ps -u "$USER"
ps -f -u "$USER"
pgrep -a -u "$USER" .
The dot is a regular-expression pattern that matches process names. This command is an alternative that does not require pgrep:
ps -f -u "$USER"
For a live display:
top -u "$USER"
Press q to leave top.
9.2 Foreground and background jobs
Start a harmless practice command:
sleep 300
Press Ctrl+Z to suspend it, then:
jobs
bg
jobs
fg
Press Ctrl+C to stop it.
Start directly in the background:
sleep 10 &
jobs
wait
&starts a command as a background job.jobsshows jobs started from the current shell.fgbrings a job to the foreground.bgcontinues a suspended job in the background.waitwaits for background jobs to finish.
9.3 Stop processes safely
First identify the correct PID and confirm it belongs to you:
ps -f -u "$USER"
kill PID
Plain kill PID sends SIGTERM, a request to exit cleanly. If the program remains after you wait and recheck, SIGKILL is a last resort:
kill -KILL PID
SIGKILL prevents cleanup and may corrupt data. Never signal a PID that you have not verified. Normal users cannot manage another user's protected processes.
You can stop a process by a matching name that belongs to you, but verify carefully:
pgrep -a -u "$USER" sleep
pkill -u "$USER" -x sleep
9.4 Resource responsibility
DWShells is shared. A process that uses excessive CPU, memory, disk, network traffic, or process slots harms other learners.
- Run only software allowed by the DWShells Acceptable Use Policy.
- Stop experiments when you finish.
- Do not create fork bombs or uncontrolled loops.
- Do not run cryptocurrency miners, scanners, attacks, spam, proxies, or unauthorized public services.
- Use persistent background programs only when your account plan and DWShells staff permit them.
nohup, terminal multiplexers, schedulers, and long-running services are useful tools, but their availability does not mean every use is allowed. Check policy first.
9.5 Administrator services
You may see tutorials using:
systemctl status SERVICE
journalctl -u SERVICE
These are service-administration tools. Some read-only views may work, but changing services requires authorization and is outside this beginner shell course. Do not try to bypass account restrictions.
Lesson 9 lab
- Start
sleep 180in the foreground. - Suspend it with Ctrl+Z.
- Continue it in the background.
- Show it with
jobsandps. - Bring it back with
fg. - Stop it with Ctrl+C.
- Start
sleep 120 &, find its PID, and stop it using normalkill. - Confirm that no practice
sleepprocess remains.
Lesson 9 review
- What does PID mean?
- What is the difference between
jobsandps? - Which signal does plain
kill PIDnormally send? - Why is SIGKILL a last resort?
- Why must long-running programs follow DWShells policy?
Lesson 10 — Inspect the system, use network tools, and transfer files
Goal: Gather read-only system information, perform limited connectivity checks, create archives, and move files securely.
10.1 System information
cat /etc/os-release
uname -r
uname -m
hostname
uptime
date
/etc/os-releaseidentifies Debian and its version.uname -rshows the kernel release.uname -mshows the hardware architecture.uptimeshows how long the server has run and its load averages.
Load average is not simply a CPU percentage. It represents work running or waiting; interpretation depends on CPU count and workload.
10.2 Memory, disk, and quota
free -h
df -h "$HOME"
du -sh "$HOME/linux-course"
du -h --max-depth=1 "$HOME/linux-course" | sort -h
quota -s
free -hsummarizes system memory.df -hshows filesystem capacity and free space.du -shmeasures the space used by a directory.quota -sshows your assigned quota when quotas and the command are enabled.
Do not run broad du searches over the whole server. Measure only paths you own or need.
10.3 Read-only network checks
Availability depends on DWShells policy:
ip address show
getent hosts darkworld.network
ping -c 4 darkworld.network
curl -I https://darkworld.network/
ip address showdisplays configured interfaces and addresses.getent hostsresolves a hostname using system configuration.ping -c 4sends four ICMP echo requests; some sites block them.curl -Iretrieves HTTP response headers without downloading the page body.
These tools are for legitimate troubleshooting. Do not probe addresses, enumerate ports, bypass filters, or scan systems without explicit authorization.
10.4 Create and inspect tar archives
Prepare an archive:
cd "$HOME/linux-course"
tar -czf lesson-04-backup.tar.gz lesson-04/
tar -tzf lesson-04-backup.tar.gz
Options:
-ccreate an archive.-tlist archive contents.-xextract.-zuse gzip compression.-fthe next argument is the archive filename.
Extract into a new, empty directory:
mkdir -p "$HOME/linux-course/restore-test"
tar -xzf lesson-04-backup.tar.gz -C "$HOME/linux-course/restore-test"
find "$HOME/linux-course/restore-test" -maxdepth 2 -type f
List an untrusted archive before extraction. Archives can contain unexpected paths or links. Ask staff before extracting unknown downloads.
If installed, ZIP commands are:
zip -r lesson-04.zip lesson-04/
unzip -l lesson-04.zip
10.5 Copy files with SCP
Run these commands on your local computer, not inside the existing SSH session.
Upload a local file:
scp local-notes.txt USERNAME@shells.darkworld.network:~/linux-course/
Download your archive:
scp USERNAME@shells.darkworld.network:~/linux-course/lesson-04-backup.tar.gz .
With a custom SSH port, SCP uses uppercase -P:
scp -P PORT_NUMBER local-notes.txt USERNAME@shells.darkworld.network:~/linux-course/
Note the difference: SSH uses lowercase -p, while SCP uses uppercase -P.
For an interactive file-transfer session:
sftp USERNAME@shells.darkworld.network
Useful SFTP commands include pwd, lpwd, ls, lls, put, get, and exit. Commands beginning with l refer to the local computer.
Lesson 10 lab
- Record the Debian version, kernel version, architecture, hostname, and date in
$HOME/linux-course/lesson-10-system.txt. - Measure the size of your course directory.
- Check available space on the filesystem containing your home directory.
- Resolve
darkworld.networkusinggetent. - Create a compressed tar archive of one lesson directory.
- List its content without extracting it.
- Extract it into a new
restore-testdirectory and compare the restored files. - If you have a local SSH client, download the archive with SCP.
Lesson 10 review
- Which file identifies the Debian release?
- What is the difference between
dfanddu? - Why can a failed
pingbe inconclusive? - Which tar option lists an archive?
- Which SCP option specifies a custom port?
Lesson 11 — Write your first Bash scripts
Goal: Combine commands into a reusable script with variables, input, tests, and a loop.
11.1 A first script
Create a script:
mkdir -p "$HOME/linux-course/lesson-11"
cd "$HOME/linux-course/lesson-11"
nano hello.sh
Enter:
#!/bin/bash
echo "Hello, $USER"
echo "Your home directory is $HOME"
echo "Today is $(date +%F)"
Save, then run it:
chmod u+x hello.sh
./hello.sh
The first line is the shebang. It tells Linux to run the file with Bash. ./ means “the file in the current directory.”
You can also run a script without execute permission by explicitly starting Bash:
bash hello.sh
11.2 Variables and arguments
Create greet.sh:
#!/bin/bash
name="$1"
if [ -z "$name" ]; then
echo "Usage: $0 NAME" >&2
exit 1
fi
echo "Welcome to DWShells, $name!"
exit 0
Run:
chmod u+x greet.sh
./greet.sh
./greet.sh "New Learner"
echo "$?"
$0— the script name.$1— the first argument.-z— true when a string is empty.>&2— send the usage message to standard error.exit 0— success;exit 1— failure.
11.3 Tests
Common safe tests:
| Test | Meaning |
|---|---|
[ -f "$path" ]
|
A regular file exists. |
[ -d "$path" ]
|
A directory exists. |
[ -r "$path" ]
|
The path is readable. |
[ -w "$path" ]
|
The path is writable. |
[ "$a" = "$b" ]
|
Two strings are equal. |
[ "$number" -gt 10 ]
|
The integer is greater than 10. |
Spaces after [ and before ] are required.
11.4 Loops
Create three files and report their line counts:
printf '%s\n' "one" > one.txt
printf '%s\n' "one" "two" > two.txt
printf '%s\n' "one" "two" "three" > three.txt
for file in *.txt; do
printf '%s: ' "$file"
wc -l < "$file"
done
Because "$file" is quoted, names containing spaces are handled safely.
11.5 A practical system report
Create system-report.sh:
#!/bin/bash
set -u
output="$HOME/linux-course/system-report.txt"
{
echo "DWShells learner system report"
echo "Generated: $(date --iso-8601=seconds)"
echo "User: $USER"
echo "Host: $(hostname)"
echo "Kernel: $(uname -r)"
echo "Architecture: $(uname -m)"
echo "Home: $HOME"
echo
echo "Course directory size:"
du -sh "$HOME/linux-course"
echo
echo "Home filesystem:"
df -h "$HOME"
} > "$output"
chmod 600 "$output"
echo "Report written to $output"
Run and inspect:
chmod u+x system-report.sh
bash -n system-report.sh
./system-report.sh
less "$HOME/linux-course/system-report.txt"
bash -n checks Bash syntax without running the script. It cannot detect every logical problem, so still review the code.
11.6 Script safety habits
- Quote variables:
"$file","$HOME","$1". - Validate required arguments and paths.
- Use absolute paths or known directories for important data.
- Do not put passwords, tokens, or private keys inside scripts.
- Avoid recursive deletion in early scripts.
- Check exit statuses when failure matters.
- Run
bash -n script.shbefore the first execution. - Read every downloaded script before running it.
Lesson 11 lab
- Create an executable script named
course-summary.sh. - Make it print the current user, date, working directory, Debian version, and course-directory size.
- Accept one argument as the learner's display name.
- If no name is supplied, print a usage message to standard error and exit non-zero.
- Write the report to
$HOME/linux-course/summary.txt. - Set the report to permission
600. - Check the script with
bash -n, run it, and inspect the result.
Lesson 11 review
- What is a shebang?
- Why is
./used to run a script in the current directory? - What do
$0and$1represent? - What exit status normally means success?
- Why should variables containing paths be quoted?
Lesson 12 — Secure your account and complete the final project
Goal: Use SSH keys safely, recognize risky behavior, follow shared-server rules, and demonstrate the skills learned.
12.1 Account security
- Use a unique, long password that you do not use on another website.
- Never share your DWShells account.
- Do not send passwords or private keys through IRC, email, screenshots, or paste sites.
- Check the hostname and SSH host-key warning before entering credentials.
- Log out from computers you do not control.
- Keep your local computer and SSH client updated.
- Report unexpected logins, altered files, or host-key changes to DWShells staff.
Change your password, if the service permits:
passwd
The command asks for the current password and then the new password twice. None of them are displayed.
12.2 SSH keys
Generate a modern key on your local computer:
ssh-keygen -t ed25519 -a 64
Choose a strong passphrase. The private key stays on your computer. The public key, usually ending in .pub, may be added to the server.
If supported:
ssh-copy-id USERNAME@shells.darkworld.network
Or copy the single public-key line into:
$HOME/.ssh/authorized_keys
Then secure the paths:
chmod 700 "$HOME/.ssh"
chmod 600 "$HOME/.ssh/authorized_keys"
Never upload or share the private-key file. Public keys may be shared for access setup; private keys must remain private.
12.3 Recognize dangerous command patterns
Pause and investigate commands that:
- download something and immediately pipe it into
shorbash; - use
sudo,su, or request administrator credentials; - contain broad recursive deletion;
- change many permissions to
777; - hide output and errors while making system changes;
- use encoded or deliberately unreadable text;
- ask for your password, token, cookie, private key, or wallet;
- start scanners, miners, proxies, spam, denial-of-service tools, or unexplained background programs.
A command being popular online does not make it safe for a shared server.
12.4 Shared-shell responsibility
Follow the current DWShells Acceptable Use Policy and the limits of your free or support account. At minimum:
- Use only resources assigned to your account.
- Do not try to read, modify, or enter another user's private data.
- Do not evade quotas, restrictions, monitoring, or network controls.
- Do not scan, attack, exploit, spam, phish, mine cryptocurrency, or host prohibited content.
- Do not expose public services without approval.
- Keep permissions restrictive and remove abandoned data and processes.
- Contact staff before an experiment that may create unusual resource or network use.
Technical ability is not permission. If a command works but policy does not allow it, do not use it.
Lesson 12 lab — Final project: Learner system report package
Build a safe project that demonstrates the course.
Required structure
linux-final/
├── README.txt
├── bin/
│ └── learner-report.sh
├── output/
│ └── learner-report.txt
└── notes/
└── commands.txt
Requirements
- Create the structure inside
$HOME/linux-course/linux-final. - Write
README.txtexplaining the project's purpose and how to run it. - Write
notes/commands.txtcontaining ten useful commands from this course and a one-line explanation of each. - Write
bin/learner-report.sh. - The script must accept the learner's display name as its first argument.
- When the argument is missing, it must show usage and exit non-zero.
- The report must include:
- learner display name;
- DWShells username;
- hostname;
- current date in ISO format;
- Debian version;
- kernel release and architecture;
- home directory;
- course-directory disk usage;
- home-filesystem free space.
- The script must write
output/learner-report.txt. - The script must quote variables and must not use
sudo,su, broad searches, or destructive commands. - Set the script to
700and its report to600. - Check it using
bash -n. - Run it twice to prove it can safely replace its own report.
- Create
$HOME/linux-course/linux-final.tar.gz. - List the archive content and extract it into a separate test directory.
- Confirm that the restored project contains all required files.
Suggested commands to begin
mkdir -p "$HOME/linux-course/linux-final"/{bin,output,notes}
cd "$HOME/linux-course/linux-final"
touch README.txt notes/commands.txt
nano bin/learner-report.sh
The brace expression creates the three directories under the same parent. If you prefer, create each one with a separate mkdir command.
Self-check
cd "$HOME/linux-course/linux-final"
find . -maxdepth 3 -print | sort
ls -l bin/learner-report.sh output/learner-report.txt
bash -n bin/learner-report.sh
bin/learner-report.sh "Your Display Name"
cat output/learner-report.txt
cd "$HOME/linux-course"
tar -czf linux-final.tar.gz linux-final/
tar -tzf linux-final.tar.gz
Lesson 12 review
- Where should an SSH private key be stored and who may receive it?
- What permissions are recommended for
~/.sshandauthorized_keys? - Why is piping a new download directly to Bash risky?
- Does technical access automatically grant permission?
- What should you do when a planned activity may create unusual server load?
Command cheat sheet
| Task | Command example |
|---|---|
| Show current directory | pwd
|
| List all files in detail | ls -lah
|
| Return home | cd
|
| Create nested directories | mkdir -p project/docs
|
| Create an empty file | touch notes.txt
|
| Copy a file safely | cp -i source destination
|
| Move or rename safely | mv -i old new
|
| Remove with confirmation | rm -i file
|
| Read a long text file | less file
|
| Edit a text file | nano file
|
| Search text | grep -in "word" file
|
| Find files in your home | find "$HOME" -type f -name "*.txt"
|
| Count lines | wc -l file
|
| View permissions | ls -l file
|
| Protect a private file | chmod 600 file
|
| Make your script executable | chmod u+x script.sh
|
| Show your processes | ps -f -u "$USER"
|
| Stop your process gracefully | kill PID
|
| Measure a directory | du -sh directory
|
| Check filesystem space | df -h "$HOME"
|
| Create a compressed archive | tar -czf backup.tar.gz directory/
|
| List an archive | tar -tzf backup.tar.gz
|
| Check Bash syntax | bash -n script.sh
|
| Log out | exit
|
Beginner glossary
| Term | Meaning |
|---|---|
| Argument | The target or value supplied to a command. |
| Bash | A common command shell and scripting language. |
| Command | An instruction executed by the shell. |
| Current directory | The directory in which your shell is presently working. |
| Debian | The Linux distribution used by DWShells. |
| Directory | A container for files and other directories. |
| Environment variable | A named value, such as HOME or PATH, available to programs.
|
| Exit status | A numeric result from a command; zero normally means success. |
| Filesystem | The organized tree of files and directories beginning at /.
|
| Home directory | A user's personal workspace, represented by ~ and $HOME.
|
| Option | A switch that changes command behavior, such as -l.
|
| Path | A file or directory location. |
| Permission | A rule controlling read, write, or execute access. |
| PID | Process ID: the unique numeric identifier of a running process. |
| Pipe | operator that sends one command's output to another command. |
| Process | A running instance of a program. |
| Prompt | The shell's signal that it is ready for a command. |
| root directory | /, the top of the filesystem tree.
|
| root user | The system administrator account; different from the root directory. |
| Shell | A program that reads commands and starts programs. |
| SSH | An encrypted protocol for secure remote shell access. |
| Standard error | A stream used for diagnostic and error messages. |
| Standard input | A stream from which a command reads data. |
| Standard output | A stream to which a command writes normal results. |
| Terminal | The application or interface used to interact with a shell. |
Where to go next
After completing the final project, good next topics are:
- Intermediate Bash scripting and error handling.
- Git version control.
- Text processing with
sedandawk. - Secure use of SSH keys and agents.
- Linux networking fundamentals.
- System administration in a dedicated lab virtual machine where you are authorized to use
sudo.
Practise administration in your own disposable virtual machine, not in a shared DWShells account. Keep using man, --help, small tests, restrictive permissions, and verified backups.
Course complete — welcome to the Linux command line!
DWTutorials Linux Basics for Beginners — © 2026 DarkWorld Network. All rights reserved.