Simple exercises for learning basic Unix/Linux commands

 

GDE Error: Error retrieving file - if necessary turn off error checking (403:Forbidden)

1. How to use the online help (manual pages)?
Use the man command to locate manual pages, for example, type man date to learn
about the date command; man w for the w command, and even man man to learn about
the man command itself. You can also do a keyword search for commands that have a
certain keyword, for example, man –k permission lists about a dozen commands that
contain the word “permission” in their descriptions.

2. How to use a text editor to create and save files?
The vi editor is available on all Unix/Linux systems although it will take some effort
to learn how to use vi. There are simpler text editors such as pico and nano but need
to be installed on your system. A simple way to create single-line text files is to use
the echo command and redirect the output using the “>” notation to a file, for example,
typing echo “A single line of text.” > file1 creates a text file named “file1” containing a
single line of words, and saves it to the current directory.

3. How to use the list file command ls (letters L and S in lower case)?
Before you start using the ls command, find out where you are within the file system
hierarchy using the pwd (print working directory) command. Suppose your current
directory is /home/doe, and there are two files named “file1” and “file2” under the
current directory. Then the command ls will list these two files (only the file names),
while the command ls –l will print a long listing of the files in the current directory. The
long listing format includes more information about the listed files, such as the file type,
permission setting, file size, owner id, last modify time, etc.
Again, suppose the current directory is /home/doe. The mkdir command creates
an empty sub-directory under here, for example, the command mkdir sub1 creates a
directory file /home/doe/sub1. After this operation, try the command ls –l which will
show the new directory “sub1” being part of the current directory. The command ls –
ld shows the settings (properties) about the current directory itself. In Unix the current
directory has an abbreviated name “.” (a single period symbol); the parent directory has
the abbreviated name “..” (two period symbols).

Leave a Reply

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