pwd and ls

The "pwd" command prints the full name (the full path) of current/working directory. By default, right after ssh-ing to a Linux machine you would find yourself in your home directory, usually /home/<username>. ssh to a cluster, type “pwd” and see if it returns ‘/home/<ISUNetID>’, where <ISUNetID> is your ISU NetID.

The "ls" command lists directory contents. ls command can be used with many options and has one optional argument. If you issue "ls -a" command in your home directory, you should see several files listed, some of the names starting with a dot. Now try issuing "ls" command without any options. You may not see any files at all. The '-a' option tells ls to display hidden files - those files, whose name start with a dot.

Issue again the "ls -a" command. The first two directories in the list should be '.' and '..'. Every directory on a Linux machine will have those two directories. The '.' directory means current directory and the '..' directory means parent directory, e.g. the directory one level up, that contains the current directory. For example, for /home/abc directory '.' will mean /home/abc and the '..' will mean /home. With no arguments "ls" command prints contents of the current directory. To see contents of the parent directory, issue "ls ..". You should see a list of users on the system. You may guess that "ls ." command will provide same output as the "ls" command. To see contents of the root directory, issue "ls /".

‘-l’ option tells ls command to use a long listing format, providing additional information about directory contents. Issue “ls -la” in your home directory. For each file the following information will be listed: file type, file permissions, file owner, group associated with the file (group owner), size, last modification date. File permissions are shown as three triplets: for the file owner, for the group owner and for everyone else on the system. For more information about file permissions, refer to the man page of chmod command: “man chmod”.

You can also use "ls" command on a regular file (non-directory). Usually you will use it with '-l' option to get file information.

For information about other options of ls command, use "ls --help" or “man ls”.