My Linux Upskill Challenge - Day 2
Introduction
Iâve started following the Linux Upskill Challenge to sharpen my Linux knowledge and hands-on skills. Itâs a series of 21 lessons designed to be completed daily, but Iâll be going through them at my own pace. Iâll share my journey and notes here as I move forward.
Day 2 - Basic navigation
- URL: https://linuxupskillchallenge.org/02/
- Previous Lesson: My Linux Upskill Challenge: Day 1
RTFM
- In this lesson, I learned a new acronym: RTFM â âRead the F
***ing Manual.â đ - When youâre learning and using Linux (or anything else) and have questions, of course, youâre always free to Google it or ask ChatGPT.
- However, the best system administrators are those who first RTFM.
This is something weâre starting to forget nowadays!
- Linux systems offer several ways to access documentation. But ifâafter searchingâyou still need help, you can always ask a well-written question in forums, Reddit, Discord, or other communities.
I think this is even more relevant today, especially when writing good prompts in the âGPT era.
Looking for Documentation
-
The
mancommand is a great place to startâmost installed applications have their own manual. -
For instance, you can find the manual for these commands:
man cpman mvman grepman ls- even
man manđ
-
That said,
manoutput can be overwhelming for some commands or too minimal for others. Thatâs wheretldrcomes inâit provides simplified, community-written man pages for common Linux (and other OS) commands.
-
tldris another tool for viewing documentation. I installed it usingsudo apt install tldr, but it didnât work right away on my EC2 instance. -
I got the following error:
tldr: /home/ubuntu/.local/share/tldr: createDirectory: does not exist (No such file or directory)- I fixed it with these two commands:
mkdir -p ~/.local/share/tldr
tldr --update- The second command pulls the latest pages from the official GitHub repo (make sure your server has internet access!).
- I tried
tldrwith the same commands as before, and yesâit showed me much more simplified info.
- I also learned about the
aproposcommand, which is equivalent toman -k. - Both are useful when you kind of know what a command does and want to search for keywords in the manual.
- For example, if you search for the phrase âremove fileâ using
apropos "remove file", youâll get results like this:
ubuntu@ip-172-31-92-220:~$ apropos "remove file"
git-rm (1) - Remove files from the working tree and from the index
rm (1) - remove files or directories
ubuntu@ip-172-31-92-220:~$ man -k "remove file"
git-rm (1) - Remove files from the working tree and from the index
rm (1) - remove files or directories-
Some commandsâespecially shell built-insâdonât have
manpages. -
For those, you can use the
helpcommand instead. -
Example: use
help exportinstead ofman export. -
I found exceptions like
echo, which works with bothman echoandhelp echo. -
The best way to check if a command is a shell built-in is to use the
typecommand.
- Lastly, thereâs the
infocommand. It gives more detailed documentation, sometimes written in a tutorial style and with hypertext navigation.
Navigate the File Structure
Linux Essentials Exam 010-160 Objectives - 2.3
-
I discovered a command that gives you documentation about the Linux file system:
man hier. -
/is the top-level directory (called root) for all other folders. -
đ§ To find out where you are in the file system, use
pwdâthis is like your GPS in Linux. đ° â 20250611T1211-pwd -
By default, youâll start in the
/home/<user>directory, unless youâre logged in asroot, in which case youâll be in/root. -
You can move between directories using
cd:cd ..takes you âupâ one level.cd .keeps you in the same folder. đ€
-
You can use either relative or absolute paths to move around:
- For example, if you first do
cd /var, then bothcd logandcd /var/logwill get you to the same place.
- For example, if you first do
-
Just running
cdreturns you to your home directory, as doescd ~. -
You can also use
~as a shortcut to move into folders inside your home directory from anywhere.- For instance, if youâre in
/var/logand want to go to/home/ubuntu/data/example, just usecd ~/data/example.
- For instance, if youâre in
ubuntu@ip-172-31-92-220:/var/log$ cd ~/data/example/
ubuntu@ip-172-31-92-220:~/data/example$Listing Files in a Folder
-
I used
lswith different options (âswitchesâ) to list files. -
For example:
ls,ls -l -L, andls -l -t -r -a(or justls -ltra). -
Files or folders that start with a
.are hidden. Usels -ato see them. -
You can combine switches and provide a folder path (argument):
e.g.,ls -ltra /var/log -
Entries that start with
dare directories. -
Some terminals show these in a different colorâif not, try
--color=auto. -
Example:
ls -l /var/log/ total 2880 -rw-r--r-- 1 root root 1810 Jun 11 09:31 alternatives.log -rw-r--r-- 1 root root 38322 May 21 21:10 alternatives.log.1 drwxr-x--- 2 root adm 4096 Jun 11 00:22 apache2 -rw-r----- 1 root adm 0 May 8 12:36 apport.log drwxr-xr-x 2 root root 4096 Jun 11 09:32 apt -rw-r----- 1 syslog adm 75999 Jun 11 12:45 auth.log -rw-r----- 1 syslog adm 103911 Jun 7 21:55 auth.log.1 -rw-r----- 1 syslog adm 17215 May 31 23:55 auth.log.2.gz -rw-r----- 1 syslog adm 15940 May 24 23:17 auth.log.3.gz -rw-r----- 1 syslog adm 1728 May 17 19:35 auth.log.4.gz -rw-r--r-- 1 root root 61237 Feb 16 14:53 bootstrap.log -rw-rw---- 1 root utmp 3600 Jun 10 17:42 btmp ...
ls -loutput breakdown
- Each line corresponds to a file or a directory, each field at the beginning of each line means something different.
- The first field is the file type & permissions, contains 10 characters where:
- The first character indicates the file type, as per the following table.
- The next nine characters (e.g.,
rw-rw----) corresponds to the file permissions, which is covered on this note: Linux file permissions
| Symbol | Type of file | Description |
|---|---|---|
d | directory | A container of another files |
- | normal file | A regular file like text, images, binaries or compressed files, etc.. |
l | symbolic link | A link to another file |
s | socket file | This is a special file used for inter-process communications (IPC) |
p | Named pipe (FIFO) | A method for unidirectional communication between processes. |
b | block device file | These are files that represent block devices (e.g. hard drives, USB drives) |
c | character device file | These are character devices (e.g., keyboards, serial ports, sound cards) |
- The next field is the Link Count, it indicates the number of hard links to this file(e.g.,
1) - The next field is the user who owns the file (e.g,
root) - The next field is the group who owns the file (e.g,
adm) - The next one is File Size in bytes ((e.g,
4096)) - Then is the Date modified (e.g,
Jun 11 00:22) - And the Filename (e.g,
apache2)
File list sort options
-
By default
lssort the results in alphabetical order -
The option
-tsort the files based on the timestamp
ls -lt /var/log- The option
-Swill sort the files based on the file size.
ls -lS /var/log- The option
-rwill revers the result or any other options.
ls -ltr /var/log
ls -lSr /var/logBasic Directory Manipulation
- I created a new folder with
mkdir test, then moved into it withcd test. - You can repeat this to build nested folder structures.
mkdir test
cd test- To move a folder into another directory, I used
mv: - Created a folder
test2, then movedexamplefromtesttotest2.
mv test/example test2- To remove an empty directory, use
rmdir. - To remove a non-empty one, use
rm -r.
Basic File Manipulation
- To create a new (empty) file:
touch newfile.txt - To move it:
mv newfile.txt test2 - To delete it:
rm
touch newfile.txt
mv newfile.txt test2
rm test2/newfile.txtA Bit More Advanced Directory Navigation (Stack-Based)
- I learned about
pushdandpopd, which let you move between folders using a stack (LIFO order). - Itâs different from
cd ..âwithpushdyou can hop to/etc, then/var/log, and then jump back in reverse order usingpopd. - Use
dirsto see the current directory stack.
pushd /etc
pushd /var/log
dirs
popd
popd- If you run
pushdwithout arguments, it swaps your current and previous directoriesâsimilar tocd -, but it remembers your path history.
So these are my notes for the Day 2 â Basic Navigation of the Linux Upskill Challenge.
Additional Resources
- Difference between help, info and man command
- GNU Texinfo
- Explore the Linux File System
- Linux File System â YouTube
- Simple Terminal Commands on Ubuntu â YouTube
- Solaris Unix Commands
Related notes
Nota diaria: 2025-05-01