EXAM OBJECTIVES COVERED
2.3 Given a scenario, create, modify, and redirect files.
3.1 Given a scenario, apply or acquire the appropriate user and/or group permissions and ownership.
Linux File and Directory Commands
It is easy to get overwhelmed by the sheer number of Linux commands. Depending on which list you look at you will find anywhere from about 125 to over 600 (the 600 number includes a lot of commands from various distributions).
This portion will cover some of the commands that will be useful for managing files and directories.
The cat Command
The cat (short for concatenate) command is a fairly simple tool designed to concatenate and write file(s) to your screen, which is known as standard output (stdout). The simplest use of cat is to show the contents of a file. One of the most common ways to use the cat command is for viewing configuration files, such as those in the /etc directory. The cat command will display a file without risking damage to it. Opening a critical configuration file using an editor such as Vi or Nano could inadvertently make unwanted changes to the file. The cat command is not an editor and therefore poses no risk of making changes to a file's content.
|-A||Equivalent to -vET.|
|-b||Number nonempty output lines.|
|-e||Equivalent to -vE.|
|-E||Display $ at end of each line.|
|-n||Number all output lines.|
|-s||Suppress repeated empty output lines.|
|-t||Equivalent to -vT.|
|-T||Display TAB characters as ^I.|
pbmac@ubuntu $ cat temp Not like the brazen giant of Greek fame, With conquering limbs astride from land to land; Here at our sea-washed, sunset gates shall stand A mighty woman with a torch, whose flame pbmac@ubuntu $
In the example the cat command is used to display the contents of the file temp.