Linux and Bash course menu
Basic Linux Commands: pwd, ls, cd and Getting Help
Learn your first Linux commands: pwd, ls, cd, how commands, options and arguments work, listing hidden files, and getting help with man and --help.
On this page
Where am I?#
pwd (print working directory) shows the folder you are in:
pwd/home/ashaWhen you open a terminal, you start in your home folder.
What is here?#
ls lists the contents of a folder:
lsdocs
notes.txt
projectsCommands, options and arguments#
Most commands follow one pattern:
command -options arguments
ls -l docsAn option changes how the command behaves, and an argument says what to work on.
ls -l docstotal 4
-rw-rw-r-- 1 asha asha 5 Nov 5 06:26 plan.txt-l means the long format. The columns are the permissions, link count, owner, group, size in bytes, modification date, and name.
Options can be combined. -a also shows hidden files, whose names start with a dot, and -h prints sizes in a readable form:
ls -lahtotal 36K
drwxr-x--- 4 asha asha 4.0K Nov 5 06:26 .
drwxr-xr-x 6 root root 4.0K Nov 5 06:22 ..
-rw-r--r-- 1 asha asha 220 Nov 5 06:26 .bash_logout
-rw-r--r-- 1 asha asha 3.7K Nov 5 06:26 .bashrc
-rw-rw-r-- 1 asha asha 7 Nov 5 06:26 .hidden
-rw-r--r-- 1 asha asha 807 Nov 5 06:26 .profile
drwxrwxr-x 2 asha asha 4.0K Nov 5 06:26 docs
-rw-rw-r-- 1 asha asha 6 Nov 5 06:26 notes.txt
drwxrwxr-x 4 asha asha 4.0K Nov 5 06:26 projects. means the current folder, and .. means the parent folder.
Moving around#
cd (change directory) moves you to another folder:
cd projects/site
pwd
cd ..
pwd
cd ~
pwd/home/asha/projects/site
/home/asha/projects
/home/ashaGetting help#
Nearly every command explains itself with --help:
ls --help | head -n 4Usage: ls [OPTION]... [FILE]...
List information about the FILEs (the current directory by default).
Sort entries alphabetically if none of -cftuvSUX nor --sort is specified.For the full manual, use man. Press q to leave, Space to go down a page, and / to search.
man lstype tells you what a name really is, and which shows where a program lives:
type cd
which lscd is a shell builtin
/usr/bin/lscd is built in to the shell, while ls is a program stored in a file.
A few useful commands#
echo "Today is a good day"
date +%Y
uname -smToday is a good day
2026
Linux x86_64clear clears the screen, and history lists the commands you have typed.
Common mistakes#
Practice#
Practice exercise
From your home folder, go into docs, print the location, list the files, and go back.
Show solution
cd docs
pwd
ls
cd -/home/asha/docs
plan.txt
/home/ashacd - prints the folder it returns to.
Key takeaway#
Next: The Linux File System.
Finished this lesson?