Etc : Bash - whoami, pwd, ls
Below is Mate's Terminal running a BASH shell, the most common Linux CLI. An Initialising Script has set the Command Prompt to consist of the users name bryan
then @
then the Computers name Debian10
, then a colon :
and finally the location, currently its ~
tilde this stands for your Home Directory, this will change as you bop from Directory(Folder) to Directory .
so it's bryan@Debian10:~
with the location being /home/bryan.
In case your command prompt is not set up to display as below and you have actually forgotten your name, type in whoami
, all lowercase and hit the Enter Key
to reconnect to yourself.

If Bash is to bare for you try Fish which has many more features: Autosuggestion -suggests commands as you type based on history and completions, syntax highlighting, Web Based Configuration etc. Fish is fully scriptable, itssyntax is simple, clean and consistent.
There is no whereami
command, so type in pwd
which stands for Print Working Directory and hit Enter
to find out where you are, this will give you the full path to your current directory, yes this is home aka ~
.
Using the Bash Terminal I am going to explore the contents of my home directory and show how Linux views files and directories...
Filenames use a forward slash to separate directories, the same as web site addresses, rather than a backslash that you see in Windows filenames. Another major difference with Windows is that filenames are CaSe-Sensitive, that is /home/supertux/hello.txt and /home/supertux/Hello.txt are two different files in supertux's home directory.
Also there is no C:\ as the root directory just / which is root, this may seem strange but makes for a very flexible file system, for instance the /home directory containing all the users files (similar to the Windows C:\Users folder) could and often is on a separate partition on the hard drive or even on a separate hard drive or in the "cloud" and the normal user would not know or even care.
Now to turn the lights on and see what's there, type in the ls
command which is short for light switch kidding its short for list as in list the files Enter.

The ls
command above is set to use colour thanks to that initialising file, directories are blue and image files are pink, very tasteful, otherwise it would be hard to distinguish directories from files.
ls
on its own lacks detail so time to use some options, these start with a "-
" for single letter options or "--
" for options that are words. The one that everyone learns first is ls -l
, l
is for long list, as in more details and for extra polish add a h
for human to display the file sizes in KB, MB and GB rather than Bytes.
So type in ls -lh
make sure to leave a space between ls
and -lh
Files and folders are by default arranged in alphabetical order, this time there is a line for each item with info arranged in columns.

The very first column is most important, the first character tells what the item is:
-
is a file and
d
is a directory.
The next six characters deal with File Permissions: who can Read or Write to a File or Directory and who can eXecute a File or look at the contents of a Directory.
There are three sets of these
- The Owner of the file in this case bryan
- The Group again bryan
- Others everybody else
More fun with that later!!!
The Second Column deals with the number of links that each file has, normally its 1, for a directory its 2 plus the number of its sub-directories (if they exist), yet more fun later taking about soft links and hard links, yippee.
The third and forth column states who owns the file, bryan
and which Group owns the file bryan
.
In most Linux Distros when you add new users to a PC a group with the users name is also created.
It gets easier from column six onwards
- Size -use the h option otherwise this is stated in bytes.
- Date and Time of last Modification.
- Finally the Filename \ Directory name.
There are many options to ls and you can see them using the command man ls
(man is short for manual).

This opens in less
a brill utility that you use to go through/search .. less is more and less has many options hit h
to see and Esc
to go back to the man page.
TMI all you need to know for now is how to navigate these man pages is..
- use the arrow keys to scroll up and down.
a small g
to goto the Start.A Capital G
to goto the end of the man page.- a
/ backslash plus word
to search the man page for that word. - then an
n
to next find next instance of that search orN
to search backwards.
With Man Pages the options are arranged in alphabetical order rather that in order of most useful so I just note a few below that I find useful.
-l
: long listing, you see all the details.-h --human-readable
: By Default file sizes are stated in bytes, not very useful so use the -h switch to list them in KB, MB, GB.-
--color
adds colour to the listing. -a, --all
show all files
In Linux files starting with a .
are hidden, they tend to be configuration files that you only need to edit occasionally so best to hide them.

The first two entries are.
which stands for this directory/home/bryan
and..
which is the parent directory/home
.
-d
which lists out the directory details rather than the files inside the directory.
sols -ld
will give the details of the current directory same as . on the first entry andls -ld /home
will give the same info as the .. entry.

-r --reverse
By default Files are listed in Alphabetically Order from A to Z usels -r
to list in Order from Z to A-S
note Capital S, lists files in order of size from largest to smallest, usels -Sr
to list from smallest to largest.-t
will sort files by modification times, newest to oldest, usels -tr
to sort from oldest to newest-R
note the Capital R to list out all sub-directories and their contents.-F --classify
note Capital F which adds an indicator such as a/
to a directory.-X
note Capital X sorts Alphabetically and by File Extensions, this is very handy, if files are named correctly the directories will be Listed first, then all the files will grouped together by their extensions, all the jpg's, docx's, odt's, pdf's.-
--group-directories-first
ok, so there are a few files with no extensions, tut tut, this nifty little option will ensure that directories are indeed listed first. -
-g
usels -g
instead ofls -l
to drop the name column. -G
when used withls -l
as inls -lG
drops the Group Column or used with thels -g
option as inls -gG
drops the Name and Group Columns.