Sunday, 9 August 2015

LINUX : BASH SHELL SCRIPT

Shell Script Basics
  • A shell script is a plain-text file that contains shell commands. It can be executed by typing its name into a shell, or by placing its name in another shell script.
  • To be executable, a shell script file must meet some conditions:
    • The file must have a special first line that names an appropriate command processor.
      #!/bin/bash
      If this example doesn't work, you will need to find out where your Bash shell executable is located and substitute that location in the above example. Here is one way to find out:
      $ whereis bash
    • The file must be made executable by changing its permission bits. An example:
      $ chmod +x (shell script filename)
  • A shell script file may optionally have an identifying suffix, like ".sh". This only helps the user remember which files are which. The command processor responsible for executing the file uses the executable bit, plus the file's first line, to decide how to handle a shell script file.
  • One normally executes a shell script this way:
    $ ./scriptname.sh
    This special entry is a way to tell the command processor that the desired script is located in the current directory. 
First Shell Script
  • This will get you past the details of writing and launching a simple script.
    1. Choose a text editor you want to use. It can be a command-line editor like emacs, pico or vi, or an X Windows editor if you have this option.
    2. Run your choice of editor and type the following lines:
      
      #!/bin/bash
      echo "Hello, world."
                        
                        

      NOTE: Be sure to place a linefeed at the end of your script. Forgetting a terminating linefeed is a common beginner's error.
    3. Save the file in the current working directory as "myscript.sh".
    4. Move from the text editor to a command shell.
    5. From the command shell, type this:
      $ chmod +x myscript.sh
    6. To execute the script, type this:
      $ ./myscript.sh
      Hello, world.

LINUX : VI EDITOR

Introduction to Vi

Vi i is one of the most popular text editors under Unix type systems (with Emacs and pico). Under Linux, there is a free version of Vi called Vim (Vi Improved). Vi  is an editor that is fully in text mode, which means that all actions are carried out with the help of text commands. This editor, although it may appear of little practical use at first, is very powerful and can be very helpful in case the graphical interface malfunctions.
The syntax to launch Vi is as follows:
vi name_of_the_file
Once the file is open, you can move around by using cursors or the keys h, j, k and l (in case the keyboard does not have any arrow cursors).

Vi modes

Vi has three operating modes:
  • Regular mode: This is the mode you enter whenever you open a file. This mode allows typing commands
  • Insertion mode: This mode makes it possible to insert characters you capture inside of the document. To switch to insertion mode, just press the key Insert on your keyboard or, by default, the key i
  • Replacement mode: This mode allows you to replace existing text by the text you capture. Just hit r again to go to replacement mode and hit the key Esc to return to regular mode

Basic commands

CommandDescription
:qQuit the editor (without saving)
:q!Forces the editor to quit without saving (even if changes were made to the document)
:wqSaves the document and quits the editor
:filenameSaves the document under the specified name

Editing commands

CommandDescription
xDeletes the character that is currently under cursor
ddDeletes the line that is currently under cursor
dxdDeletes x lines starting with the one currently under the cursor
nxDeletes n characters starting with the one currently under the cursor
x>>Indents x lines to the right starting with the one currently under the cursor
x<<Indents x lines to the left starting with the one currently under the cursor

Searching and replacing

To search for a word in a document, in regular mode, just type / followed by the chain of characters to be searched for and confirm by hitting the Enter key. Use the n key to go from occurrence to occurrence.
To replace a chain of characters by another on a line, you will find a very powerful command in Vi by using the regular expressions. Its syntax is as follows:
:s/chain_to_be_replaced/replacement_chain/
The replacement can be made throughout the entire document with the following syntax:
:%s/chain_to_be_replaced/replacement_chain/

Copy-paste and cut-paste

In Vi, it is possible to copy-paste a selection of lines. To do so, just type in the following command to copy n lines:
nyy
For example, the following command will copy 16 lines onto the clipboard:
16yy
To past the selection, just type the letter p.
Cutting-pasting n lines is similar by using the command:
ndd
Then p to paste!

PERMISSION COMMANDS : LINUX

Permissions

The Unix operating system (and likewise, Linux) differs from other computing environments in that it is not only a multi-tasking system but it is also a multi-user system as well.

It means that more than one user can be operating the computer at the same time. While your computer will only have one keyboard and monitor, it can still be used by more than one user. For example, if your computer is attached to a network, or the Internet, remote users can log in via telnet or ssh (secure shell) and operate the computer. In fact, remote users can execute X applications and have the graphical output displayed on a remote computer. The X Windows system supports this.
The multi-user capability of Unix is not a recent "innovation," but rather a feature that is deeply ingrained into the design of the operating system. A typical university computer system consisted of a large mainframe computer located in some building on campus and terminals were located throughout the campus, each connected to the large central computer. The computer would support many users at the same time.
In order to make this practical, a method had to be devised to protect the users from each other. After all, you could not allow the actions of one user to crash the computer, nor could you allow one user to interfere with the files belonging to another user.
This lesson will cover the following commands:
  • chmod - modify file access rights
  • su - temporarily become the superuser
  • chown - change file ownership
  • chgrp - change a file's group ownership

File permissions

Linux uses the same permissions scheme as Unix. Each file and directory on your system is assigned access rights for the owner of the file, the members of a group of related users, and everybody else. Rights can be assigned to read a file, to write a file, and to execute a file (i.e., run the file as a program).
To see the permission settings for a file, we can use the ls command as follows:
[me@linuxbox me]$ ls -l some_file

-rw-rw-r-- 1 me   me   1097374 Sep 26 18:48 some_file
We can determine a lot from examining the results of this command:
  • The file "some_file" is owned by user "me"
  • User "me" has the right to read and write this file
  • The file is owned by the group "me"
  • Members of the group "me" can also read and write this file
  • Everybody else can read this file
Let's try another example. We will look at the bash program which is located in the /bin directory:
[me@linuxbox me]$ ls -l /bin/bash

-rwxr-xr-x 1 root root  316848 Feb 27  2000 /bin/bash
Here we can see:
  • The file "/bin/bash" is owned by user "root"
  • The superuser has the right to read, write, and execute this file
  • The file is owned by the group "root"
  • Members of the group "root" can also read and execute this file
  • Everybody else can read and execute this file
In the diagram below, we see how the first portion of the listing is interpreted. It consists of a character indicating the file type, followed by three sets of three characters that convey the reading, writing and execution permission for the owner, group, and everybody else.

permissions diagram

chmod

The chmod command is used to change the permissions of a file or directory. To use it, you specify the desired permission settings and the file or files that you wish to modify. There are two ways to specify the permissions.
It is easy to think of the permission settings as a series of bits (which is how the computer thinks about them). Here's how it works:
rwx rwx rwx = 111 111 111
rw- rw- rw- = 110 110 110
rwx --- --- = 111 000 000

and so on...

rwx = 111 in binary = 7
rw- = 110 in binary = 6
r-x = 101 in binary = 5
r-- = 100 in binary = 4

Now, if you represent each of the three sets of permissions (owner, group, and other) as a single digit, you have a pretty convenient way of expressing the possible permissions settings. For example, if we wanted to set some_file to have read and write permission for the owner, but wanted to keep the file private from others, we would:
[me@linuxbox me]$ chmod 600 some_file
Here is a table of numbers that covers all the common settings. The ones beginning with "7" are used with programs (since they enable execution) and the rest are for other kinds of files.
ValueMeaning
777(rwxrwxrwx) No restrictions on permissions. Anybody may do anything. Generally not a desirable setting.
755(rwxr-xr-x) The file's owner may read, write, and execute the file. All others may read and execute the file. This setting is common for programs that are used by all users.
700(rwx------) The file's owner may read, write, and execute the file. Nobody else has any rights. This setting is useful for programs that only the owner may use and must be kept private from others.
666(rw-rw-rw-) All users may read and write the file.
644(rw-r--r--) The owner may read and write a file, while all others may only read the file. A common setting for data files that everybody may read, but only the owner may change.
600(rw-------) The owner may read and write a file. All others have no rights. A common setting for data files that the owner wants to keep private.

Directory permissions

The chmod command can also be used to control the access permissions for directories. In most ways, the permissions scheme for directories works the same way as they do with files. However, the execution permission is used in a different way. It provides control for access to file listing and other things. Here are some useful settings for directories:
ValueMeaning
777(rwxrwxrwx) No restrictions on permissions. Anybody may list files, create new files in the directory and delete files in the directory. Generally not a good setting.
755(rwxr-xr-x) The directory owner has full access. All others may list the directory, but cannot create files nor delete them. This setting is common for directories that you wish to share with other users.
700(rwx------) The directory owner has full access. Nobody else has any rights. This setting is useful for directories that only the owner may use and must be kept private from others.

Becoming the superuser for a short while

It is often useful to become the superuser to perform important system administration tasks, but as you have been warned (and not just by me!), you should not stay logged on as the superuser. In most distributions, there is a program that can give you temporary access to the superuser's privileges. This program is called su (short for substitute user) and can be used in those cases when you need to be the superuser for a small number of tasks. To become the superuser, simply type the su command. You will be prompted for the superuser's password:
[me@linuxbox me]$ su
Password:
[root@linuxbox me]#
After executing the su command, you have a new shell session as the superuser. To exit the superuser session, type exit and you will return to your previous session.
In some distributions, most notably Ubuntu, an alternate method is used. Rather than using su, these systems employ the sudo command instead. With sudo, one or more users are granted superuser privileges on an as needed basis. To execute a command as the superuser, the desired command is simply preceeded with the sudo command. After the command is entered, the user is prompted for the user's password rather than the superuser's:
[me@linuxbox me]$ sudo some_command
Password:
[me@linuxbox me]$

Changing file ownership

You can change the owner of a file by using the chown command. Here's an example: Suppose I wanted to change the owner of some_file from "me" to "you". I could:
[me@linuxbox me]$ su
Password:
[root@linuxbox me]# chown you some_file
[root@linuxbox me]# exit
[me@linuxbox me]$
Notice that in order to change the owner of a file, you must be the superuser. To do this, our example employed the su command, then we executed chown, and finally we typed exit to return to our previous session.
chown works the same way on directories as it does on files.

Changing group ownership

The group ownership of a file or directory may be changed with chgrp. This command is used like this:
[me@linuxbox me]$ chgrp new_group some_file
In the example above, we changed the group ownership of some_file from its previous group to "new_group". You must be the owner of the file or directory to perform a chgrp.

LINUX COMMANDS : I/O REDIRECTION

I/O Redirection

A powerful feature used by many command line programs called input/output redirection. As we have seen, many commands such as ls print their output on the display. By using some special notation we can redirect the output of many commands to files, devices, and even to the input of other commands.

Standard Output

Most command line programs that display their results do so by sending their results to a facility called standard output. By default, standard output directs its contents to the display. To redirect standard output to a file, the ">" character is used like this:
[me@linuxbox me]$ ls > file_list.txt
In this example, the ls command is executed and the results are written in a file named file_list.txt. Since the output of ls was redirected to the file, no results appear on the display.
Each time the command above is repeated, file_list.txt is overwritten (from the beginning) with the output of the command ls. If you want the new results to be appended to the file instead, use ">>" like this:
[me@linuxbox me]$ ls >> file_list.txt
When the results are appended, the new results are added to the end of the file, thus making the file longer each time the command is repeated. If the file does not exist when you attempt to append the redirected output, the file will be created.

Standard Input

Many commands can accept input from a facility called standard input. By default, standard input gets its contents from the keyboard, but like standard output, it can be redirected. To redirect standard input from a file instead of the keyboard, the "<" character is used like this:
[me@linuxbox me]$ sort < file_list.txt
In the above example we used the sort command to process the contents of file_list.txt. The results are output on the display since the standard output is not redirected in this example. We could redirect standard output to another file like this:
[me@linuxbox me]$ sort < file_list.txt > sorted_file_list.txt
As you can see, a command can have both its input and output redirected. Be aware that the order of the redirection does not matter. The only requirement is that the redirection operators (the "<" and ">") must appear after the other options and arguments in the command.

Pipes

The most useful and powerful thing you can do with I/O redirection is to connect multiple commands together with what are called pipes. With pipes, the standard output of one command is fed into the standard input of another. 

[me@linuxbox me]$ ls -l | less
In this example, the output of the ls command is fed into less. By using this "| less" trick, you can make any command have scrolling output. I use this technique all the time.
By connecting commands together, you can acomplish amazing feats. Here are some examples you'll want to try:
Examples of commands used together with pipes
CommandWhat it does
ls -lt | headDisplays the 10 newest files in the current directory.
du | sort -nrDisplays a list of directories and how much space they consume, sorted from the largest to the smallest.
find . -type f -print | wc -lDisplays the total number of files in the current working directory and all of its subdirectories.

Filters

One class of programs you can use with pipes is called filters. Filters take standard input and perform an operation upon it and send the results to standard output. In this way, they can be used to process information in powerful ways. Here are some of the common programs that can act as filters:
Common filter commands
ProgramWhat it does
sortSorts standard input then outputs the sorted result on standard output.
uniqGiven a sorted stream of data from standard input, it removes duplicate lines of data (i.e., it makes sure that every line is unique).
grepExamines each line of data it receives from standard input and outputs every line that contains a specified pattern of characters.
fmtReads text from standard input, then outputs formatted text on standard output.
prTakes text input from standard input and splits the data into pages with page breaks, headers and footers in preparation for printing.
headOutputs the first few lines of its input. Useful for getting the header of a file.
tailOutputs the last few lines of its input. Useful for things like getting the most recent entries from a log file.
trTranslates characters. Can be used to perform tasks such as upper/lowercase conversions or changing line termination characters from one type to another (for example, converting DOS text files into Unix style text files).
sedStream editor. Can perform more sophisticated text translations than tr.
awkAn entire programming language designed for constructing filters. Extremely powerful.

LINUX : LS COMMAND & DIRECTORIES TOUR

Commands Tour

ls

The ls command is used to list the contents of a directory. It is probably the most commonly used Linux command. It can be used in a number of different ways. Here are some examples:
Examples of the ls command
CommandResult
lsList the files in the working directory
ls /binList the files in the /bin directory (or any other directory you care to specify)
ls -lList the files in the working directory in long format
ls -l /etc /binList the files in the /bin directory and the /etc directory in long format
ls -la ..List all files (even ones with names beginning with a period character, which are normally hidden) in the parent of the working directory in long format
These examples also point out an important concept about commands. Most commands operate like this:

    command -options arguments

where command is the name of the command, -options is one or more adjustments to the command's behavior, and arguments is one or more "things" upon which the command operates.
In the case of ls, we see that ls is the name of the command, and that it can have one or more options, such as -a and -l, and it can operate on one or more files or directories.

A Closer Look At Long Format

If you use the -l option with ls, you will get a file listing that contains a wealth of information about the files


-rw-------   1 bshotts  bshotts       576 Apr 17  1998 weather.txt
drwxr-xr-x   6 bshotts  bshotts      1024 Oct  9  1999 web_page
-rw-rw-r--   1 bshotts  bshotts    276480 Feb 11 20:41 web_site.tar
-rw-------   1 bshotts  bshotts      5743 Dec 16  1998 xmas_file.txt

----------     -------  -------  -------- ------------ -------------
    |             |        |         |         |             |
    |             |        |         |         |         File Name
    |             |        |         |         |
    |             |        |         |         +---  Modification Time
    |             |        |         |
    |             |        |         +-------------   Size (in bytes)
    |             |        |
    |             |        +-----------------------        Group
    |             |
    |             +--------------------------------        Owner
    |
    +----------------------------------------------   File Permissions


File Name
The name of the file or directory.
Modification Time
The last time the file was modified. If the last modification occurred more than six months in the past, the date and year are displayed. Otherwise, the time of day is shown.
Size
The size of the file in bytes.
Group
The name of the group that has file permissions in addition to the file's owner.
Owner
The name of the user who owns the file.
File Permissions
A representation of the file's access permissions. The first character is the type of file. A "-" indicates a regular (ordinary) file. A "d" indicates a directory. The second set of three characters represent the read, write, and execution rights of the file's owner. The next three represent the rights of the file's group, and the final three represent the rights granted to everybody else.



  • cd into each directory.
  • Use ls to list the contents of the directory.
  • If you see an interesting file, use the file command to determine its contents.
  • For text files, use less to view them.
Interesting directories and their contents
DirectoryDescription
/The root directory where the file system begins. In most cases the root directory only contains subdirectories.
/bootThis is where the Linux kernel and boot loader files are kept. The kernel is a file called vmlinuz.
/etcThe /etc directory contains the configuration files for the system. All of the files in /etc should be text files. Points of interest:
/etc/passwd
The passwd file contains the essential information for each user. It is here that users are defined.
/etc/fstab
The fstab file contains a table of devices that get mounted when your system boots. This file defines your disk drives.
/etc/hosts
This file lists the network host names and IP addresses that are intrinsically known to the system.
/etc/init.d
This directory contains the scripts that start various system services typically at boot time.
/bin, /usr/binThese two directories contain most of the programs for the system. The /bin directory has the essential programs that the system requires to operate, while /usr/bin contains applications for the system's users.
/sbin, /usr/sbinThe sbin directories contain programs for system administration, mostly for use by the superuser.
/usrThe /usr directory contains a variety of things that support user applications. Some highlights:
/usr/share/X11
Support files for the X Windows system
/usr/share/dict
Dictionaries for the spelling checker. Bet you didn't know that Linux had a spelling checker. Seelook and ispell.
/usr/share/doc
Various documentation files in a variety of formats.
/usr/share/man
The man pages are kept here.
/usr/src
Source code files. If you installed the kernel source code package, you will find the entire Linux kernel source code here.
/usr/local/usr/local and its subdirectories are used for the installation of software and other files for use on the local machine. What this really means is that software that is not part of the official distribution (which usually goes in /usr/bin) goes here.

When you find interesting programs to install on your system, they should be installed in one of the/usr/local directories. Most often, the directory of choice is /usr/local/bin.
/varThe /var directory contains files that change as the system is running. This includes:
/var/log
Directory that contains log files. These are updated as the system runs. You should view the files in this directory from time to time, to monitor the health of your system.
/var/spool
This directory is used to hold files that are queued for some process, such as mail messages and print jobs. When a user's mail first arrives on the local system (assuming you have local mail), the messages are first stored in /var/spool/mail
/libThe shared libraries (similar to DLLs in that other operating system) are kept here.
/home/home is where users keep their personal work. In general, this is the only place users are allowed to write files. This keeps things nice and clean
/rootThis is the superuser's home directory.
/tmp/tmp is a directory in which programs can write their temporary files.
/devThe /dev directory is a special directory, since it does not really contain files in the usual sense. Rather, it contains devices that are available to the system. In Linux (like Unix), devices are treated like files. You can read and write devices as though they were files. For example /dev/fd0 is the first floppy disk drive, /dev/sda (/dev/hda on older systems) is the first IDE hard drive. All the devices that the kernel understands are represented here.
/procThe /proc directory is also special. This directory does not contain files. In fact, this directory does not really exist at all. It is entirely virtual. The /proc directory contains little peep holes into the kernel itself. There are a group of numbered entries in this directory that correspond to all the processes running on the system. In addition, there are a number of named entries that permit access to the current configuration of the system. Many of these entries can be viewed. Try viewing/proc/cpuinfo. This entry will tell you what the kernel thinks of your CPU.
/media,/mntFinally, we come to /media, a normal directory which is used in a special way. The /media directory is used for mount points.  This process of attaching a device to the tree is called mounting. For a device to be available, it must first be mounted.

When your system boots, it reads a list of mounting instructions in the file /etc/fstab, which describes which device is mounted at which mount point in the directory tree. This takes care of the hard drives, but you may also have devices that are considered temporary, such as CD-ROMs and floppy disks. Since these are removable, they do not stay mounted all the time. The /media directory is used by the automatic device mounting mechanisms found in modern desktop oriented Linux distributions. On systems that require manual mounting of removable devices, the /mnt directory provides a convenient place for mounting these temporary devices. You will often see the directories /mnt/floppy and /mnt/cdrom. To see what devices and mount points are used, type mount.



INTRODUCTION TO LINUX BASIC COMMANDS

File System Organization

Like that legacy operating system, the files on a Linux system are arranged in what is called a hierarchical directory structure. This means that they are organized in a tree-like pattern of directories (called folders in other systems), which may contain files and other directories. The first directory in the file system is called the root directory. The root directory contains files and sub-directories, which contain more files and sub-directories and so on.
Most graphical environments today include a file manager program to view and manipulate the contents of the file system. Often you will see the file system represented like this:
directory tree
One important difference between the legacy operating system and Unix/Linux is that Linux does not employ the concept of drive letters. While drive letters split the file system into a series of different trees (one for each drive), Linux always has a single tree. Different storage devices may contain different branches of the tree, but there is always a single tree.

pwd

Since a command line interface cannot provide graphic pictures of the file system structure, it must have a different way of representing it. Think of the file system tree as a maze, and you are standing in it. At any given moment, you stand in a single directory. Inside that directory, you can see its files and the pathway to its parent directory and the pathways to the subdirectories of the directory in which you are standing.
The directory you are standing in is called the working directory. To find the name of the working directory, use the pwdcommand.
[me@linuxbox me]$ pwd
/home/me
When you first log on to a Linux system, the working directory is set to your home directory. This is where you put your files. On most systems, your home directory will be called /home/your_user_name, but it can be anything according to the whims of the system administrator.
To list the files in the working directory, use the ls command.
[me@linuxbox me]$ ls

Desktop     Xrootenv.0    linuxcmd
GNUstep     bin           nedit.rpm
GUILG00.GZ  hitni123.jpg  nsmail

cd

To change your working directory (where you are standing in the maze) you use the cd command. To do this, type cd followed by the pathname of the desired working directory. A pathname is the route you take along the branches of the tree to get to the directory you want. Pathnames can be specified in one of two different ways; absolute pathnames or relative pathnames. Let's deal with absolute pathnames first.
An absolute pathname begins with the root directory and follows the tree branch by branch until the path to the desired directory or file is completed. For example, there is a directory on your system in which programs are installed for the X window system. The pathname of the directory is /usr/X11R6/bin. This means from the root directory (represented by the leading slash in the pathname) there is a directory called "usr" which contains a directory called "X11R6" which contains a directory called "bin".
Let's try this out:
[me@linuxbox me]$ cd /usr/X11R6/bin
[me@linuxbox bin]$ pwd
/usr/X11R6/bin
[me@linuxbox bin]$ ls
Animate               import                xfwp
AnotherLevel          lbxproxy              xg3
Audio                 listres               xgal
Auto                  lndir                 xgammon
Banner                makedepend            xgc
Cascade               makeg                 xgetfile
Clean                 mergelib              xgopher
Form                  mkdirhier             xhexagons
Ident                 mkfontdir             xhost
Pager                 mkxauth               xieperf
Pager_noxpm           mogrify               xinit
RunWM                 montage               xiterm
RunWM.AfterStep       mtv                   xjewel
RunWM.Fvwm95          mtvp                  xkbbell
RunWM.MWM             nxterm                xkbcomp

and many more...

Now we can see that we have changed the current working directory to /usr/X11R6/bin and that it is full of files.  As a convenience, it is usually set up to display the name of the working directory.
Where an absolute pathname starts from the root directory and leads to its destination, a relative pathname starts from the working directory. To do this, it uses a couple of special symbols to represent relative positions in the file system tree. These special symbols are "." (dot) and ".." (dot dot).
The "." symbol refers to the working directory and the ".." symbol refers to the working directory's parent directory. Here is how it works. Let's change the working directory to /usr/X11R6/bin again:
[me@linuxbox me]$ cd /usr/X11R6/bin
[me@linuxbox bin]$ pwd
/usr/X11R6/bin
Now let's say that we wanted to change the working directory to the parent of /usr/X11R6/bin which is /usr/X11R6. We could do that two different ways. First, with an absolute pathname:
[me@linuxbox bin]$ cd /usr/X11R6
[me@linuxbox X11R6]$ pwd
/usr/X11R6
Or, with a relative pathname:
[me@linuxbox bin]$ cd ..
[me@linuxbox X11R6]$ pwd
/usr/X11R6
Two different methods with identical results. Which one should you use? The one that requires less typing!
Likewise, we can change the working directory from /usr/X11R6 to /usr/X11R6/bin in two different ways. First using an absolute pathname:
[me@linuxbox X11R6]$ cd /usr/X11R6/bin
[me@linuxbox bin]$ pwd
/usr/X11R6/bin
Or, with a relative pathname:
[me@linuxbox X11R6]$ cd ./bin
[me@linuxbox bin]$ pwd
/usr/X11R6/bin
Now, there is something important that I must point out here. In almost all cases, you can omit the "./". It is implied. 
[me@linuxbox X11R6]$ cd bin
If you do not specify a pathname to something, the working directory will be assumed. 

A couple of shortcuts

If you type cd followed by nothing, cd will change the working directory to your home directory.
A related shortcut is to type cd ~user_name. In this case, cd will change the working directory to the home directory of the specified user.