
You can concatenate as many files as you want into a single file using cat. $ cat grocerylist.txt todo_list.txt > Saturday.txt To use cat for its file concatenation powers, the general form of the command is:įor example, to redirect the contents of grocerylist.txt and todo_list.txt into the Saturday.txt file: If you want to see a file's contents, use the following format:įor example, you might type the following to display the contents of the system's passwd file on the screen: Printing the contents of files is by far the more frequent use of this command. The cat command is important as a basic command because it serves two very important functions: concatenating (merging) files (as the name suggests) and printing the contents of a file to the screen. As an example, look at the man page for the ls command. Use the Enter key to advance one line at a time, the ' b' key to go back, the Space bar to advance a full-screen page, and the ' q' key to exit the man page. The abbreviated command for referencing this documentation is, man and a screen-full of information appears before you. They're referred to as manual pages, as in read the manual. Linux has an extensive set of online documentation for your reference. The -a switch-or option, as it's called-shows you all files, even hidden ones. You now see several files beginning with a period.

Hidden files in Linux begin with a period (.

In your home directory, where you are now, you probably have hidden files. You've successfully listed the contents of the /etc directory, but you can actually list files in several different ways. The /etc ( et-see) directory is where a Linux system's configuration files live.Ī large number of files (over 200) appear on your screen. The ls command won't show you much in your home directory on a new system, so let's explore a directory that contains a lot of files and directories: /etc. If you simply type ls at a prompt ( $), you'll see all non-hidden files in your current directory, which is your home directory when you first log into a Linux system. The list ( ls) command is equivalent to the DOS DIR command, in that it lists files and directories.

Linux system administration skills assessment.
