Raspberry Pi Linux for Beginners 2

This is tutorial number two about command line Linux. I assume you are running an up-to-date full version of Raspbian for this tutorial.  We will determine our current directory, how to change directories and how to determine the files and subdirectories therein.

Using pwd to print the working directory and cd to change directory…  In the screenshot below pwd shows my current directory to be /home/pi.  Notice the ~ (tilde) in the command line prompt itself.  The tilde indicates I am in my (pi’s) home directory.  Next I issue a cd .. to move up one directory from /home/pi to /home.  Next is another pwd just to show that I am in the directory /home.  Because /pi is a directory within /home I can issue cd pi and move back to my home directory /home/pi.  Again I confirm it with pwd.

Using ls to list files in directory…  In the screenshot below I have demonstrated several different ways to use ls.  First I use pwd to show my current directory just for the sake of showing you where I am in the file structure.  Next I use ls to show a list of files and directories.  The blue type indicates that a it is a directory and white indicates it is a file.  This coloring system varies widely or is not present in some terminal clients (more below).  Next I issue the ls -a command which shows all of the files and directories, even the hidden ones that start with a period.  Next is the ls -l command to show file details in the following order: permissions (made of d, r, w, x and – characters), owner, group, size, last modified date and time and the name of the directory or file.  If the first character is a “d” for an item in  the ls -l output then it is a directory.  The command ls -al (not shown because it is a lot of output) shows all of the files and directories in detail.  The ls -al command is best used with | more like so: ls -al | more.

 

Facebooktwittergoogle_plusredditpinterestlinkedinmail

Leave a Reply

Your email address will not be published. Required fields are marked *