Basic commands

The following is a basic that the terminal will pass to the operating system and perform the action.  Commands can also use flags in the form of – followed by a letter.  This extends the capability of the command.

Enter the following command.

$ ls

This will list any files in the current directory. These commands can be extended by using flags.  A flag is an additional option to the command which allows it to perform additional functions.  For example enter the following.

$ ls -F

/Desktop             /Downloads       /Music                  MyTextFile.txt                  MyProgram.py

The forward slash at the beginning of the file indicates that this is a folder. Desktop, Downloads & Music are all folders but MyTextFile.txt and MyProgram.py are files.

Enter the following command.

$ ls -l

This flag will list the files in a longer format which include the permissions for the files, who owns the file and the date that it was created.  Permissions are indicated by the

drwxr-xr-x

Permission will be explained later along with file ownership.  You can also combine flags to give you additional results.  Enter the following.

$ ls -lF

This will list the files in long format and will also display the forward slash / to indicate folders.

You can use the following flags to display more information.

-d        list the name of the current directory

-F        show directories with a trailing ‘/’

  -a        List the hidden files. 

-g        show group ownership of file in long listing

-l        Displays details in a long format about files and directories.

-t        Sort by time modified.

-R        Displays all subdirectories.

-i        print the inode number of each file

 

To expand on what you have already learned enter the following command.

$ clear

This command will clear the terminal window and the date command will display the current date.  Enter the command.

$ date

Enter the following command to display some information about the system.

$ uname -a

Another great little feature of the terminal is its history.  By pressing the up arrow key, it will allow you to browse the commands that you have previously entered.

File System Structure

Next Raspberry Pi Week 4 – Day 3 File System Structure >>