/ factorpad.com / tech / full-stack / navigate-linux.html
An ad-free and cookie-free website.
Beginner
Videos can also be accessed from our Full Stack Playlist 2 on YouTube.
Navigate Linux directories with 7 basic Linux commands | Linux Tutorial for Beginners (4:55)
Welcome. Today's question: How do you navigate Linux?
I'm Paul, and in this video you will learn how to negotiate the fast lane using the Linux command line.
Okay, so these seven commands cover most of our basic navigation.
pwd
cd
ls
mkdir
cp
mv
rm
And we will practice with others introduced earlier in this Project, Linux for Beginners.
whatis
nano
clear
exit
We will start at the Terminal with command syntax, practice with each
command, then highlight a few takeaways with notes using
nano
, before the next video on
finding help. Here we go.
Let's use this Windows PC, open a Terminal and find our bearings with
the pwd
command showing where we
currently sit on this local server.
It will help to understand that you're always sitting somewhere in
Linux. The directory structure starts here
/
at what is called the root, and
inside it sits a directory called home
,
and within that is my directory paul
.
Next, use the cd
command to change
directories to a subdirectory called
notes
and
pwd
again.
Let's talk syntax, and most of the time it goes like this:
$ command -option(s) argument(s)
, so
there can be none or multiple options and arguments.
With this pound or hash symbol here #
,
known as a comment, the rest of the line isn't processed by Linux. I
just wanted to note that.
Let's practice with commands by using four versions of
ls
, listing files in this directory.
First, ls
without options and without
arguments and it defaults to the current working directory.
Second, the ls
command, with one
option, -1
, and no arguments shows
the same list but in one column.
Third, going with multiple options at once, adding
o
and
g
shows details but suppresses owner
and group information.
And fourth, let's skip the options and add an argument, here explicitly saying which directory to look in.
There's our directory called notes
.
So now you know ls
and command syntax.
Don't worry about memorizing just yet, it would be better if I show you
where to find options and arguments for yourself, later, and in tutorial
#13.
Next, mkdir
. Let's make a directory
within the current directory using
mkdir
with the argument
backup
, and use
ls
to verify, okay.
Next, cp
is for copying files and
directories, so let's copy
notes
from
video0011.txt
to the new
backup
directory, and then
ls
to verify.
Next, mv
moves and renames files, but
it also works with directories, and let's test it, with a convenient
option -i
, called interactive. It
prompts us if we're about to overwrite something. Linux assumes you
know what you're doing, so when in doubt use
-i
.
Okay, rm
is used to remove both files
and directories. Let's say we want to undo what we just did, which can
be accomplished using two options and one argument. The
-i
option again for a prompt, and
-r
for recursive, meaning it will
delete directories and their contents. We'll accept these, then
ls
to verify.
And in some cases, options are specified with double-dash as with the
whatis
command. Watch this,
-h
shows help.
As does --help
.
And while we are here, make note of a nice summary of 12 short-form
options and 13 long-form options available for
whatis
.
And while I open nano video0012.txt
to
save a few notes, I mentioned fast lane earlier. If you're addicted to
your Graphical User Interface (GUI), like most of us are, think about
how much longer this whole exercise would have taken using the
point-and-click in Windows File Explorer or Finder in a Mac.
Yes, of course navigation isn't as visual in Linux, but if we were to judge on speed, Linux wins.
We covered a lot of ground in 4 minutes, so it may be helpful to play around with these commands later, because as we get going with this, our Data Science stack, navigation will be vital.
Next, I'll show you how to find help, going far beyond what we've done
here with whatis
.
Have a nice day.
If you didn't watch the video, you should. It will help with your retention and they're quick (under 5 minutes in this Playlist).
/ factorpad.com / tech / full-stack / navigate-linux.html
A newly-updated free resource. Connect and refer a friend today.