Many of the standard tools that come with a Linux environment adhere to the Unix philosophy. Learn what that is in this video.
- [Instructor] As we start exploring command line tools, it's important to understand the principle behind many of the programs we'll be looking at. That principle, often called the UNIX philosophy, is that a tool should do one thing and do it well. It recommends that programs use text interfaces, which means not that what you see when you're using the tool is a text-based environment, but that the tool should expect to take in text from a file or stream and output text once it's done processing. This philosophy suggests that we shouldn't have tools that try to do too much.
We don't want a tool that reads files and separates some of the text into another file and renames that file and compresses it into an archive when it's done, or tries to do everything that anyone can possibly want to do. We want one tool to do each of those tasks, so we can use those specialized tools in any way we want to. Of course, there are many applications that include many features, including ones I mentioned before, and that's fine. Those applications aren't the ones we're talking about here. We're talking about the standard set of command line tools that can be configured to work together in an incredible number of ways.
We want to think of the tools not as a multifunction Swiss army knife, but as a well-stocked kitchen of chef's tools. Sure, you can open a can with the little Swiss army knife attachment or try to chop a tomato with a tiny blade, but none of those multi function tools does anything particularly well, certainly not well enough to prepare a meal you're proud of. To get real work done, you want quality, dedicated tools that can work together easily. Think of an assembly line where one machine does one task and then passes the product onto the next specialized machine, rather than one complicated robot doing many different tasks on the same item.
The point here is not that we have one multifunction generalist program. You're the generalist, picking tools from your toolbox to do exactly what you need to do. We want to be able to incorporate the right tools into doing a task as flexibly as possible, and as we'll see in a little bit, this philosophy underlies a lot of how you work at the command line. You will use one program to read text from a file, then send it to a program that filters certain text. Then the output of that program gets processed, so that it doesn't have duplicate lines and then the result of that will get written back to a file.
Modularity and flexibility are features, not limitations, of working at the command line.
- Recognize what the characters “-h” represent in the statement “df –h/home/alice/Documents”.
- Explain how to recall a previous command in Bash.
- Identify what the command “ls -l” will show.
- Recall what is needed to use the find command to look for files by name, size, and so on.
- List the two modes file permissions can be set to.
- Recall why many command line tools are intended to be used in pipes with other commands.
- Explain what the command “grep -E "" report.txt” will show.
- Identify what the “>” symbol is often used for.