If you need to search for one or more particular files or directories, the find command in Linux is the perfect tool for the job. The find command can search for a file with a specific name, but you can also search for files that follow certain naming patterns. This can be broadened all the way to finding files based on file size, file extension, or a lot of other options.
terminal
fold command in Linux with examples
The fold command in Linux is used to wrap the lines of a file at a predetermined length. Its original use was to facilitate the viewing of large files on a terminal screen, and having each line be wrapped at a certain length so everything could fit on the monitor. Back in the 1970s, before terminals and applications had word wrap functionality by default, this was very handy.
nl command in Linux with examples
The nl command in Linux is an abbreviation for number lines. If you’ve ever had a large text document and needed to add line numbers to it, the nl command is your saving grace. Rather than going through the painstaking process of numbering each line manually, or importing your text document into a GUI text editor, you can simply use nl from the command line and be done in a matter of seconds.
cp command in Linux with examples
mv command in Linux with examples
The mv command in Linux is short for move. As you can probably guess or may already know, the command is used to move files and directories from one location to the other. Users that are more accustomed to a GUI might know this action better as “cutting and pasting.” The mv command is just the command line equivalent of that action.
pwd command in Linux with examples
The pwd command in Linux is short for present working directory. When it comes to Linux commands, this has to be one of the simplest. It’s only function is to print the present working directory of your terminal. It comes in handy when you’re not exactly sure what directory you’re in, or when you need to pass the present working directory inside of a Bash script, for example.
head command in Linux with examples
The head command in Linux is one of the most important commands you’ll need when viewing text files. If you’re new to Linux, the head command is a perfect place to start, since it has a simple syntax and straight forward purpose. The head command is the complementary command to the tail command. The head command is used to print the first 10 lines (by default) of one or multiple files.
mkdir command in Linux with examples
One of the most common and fundamental commands in Linux is the mkdir command. The most basic way to use this command is to create one or multiple directories. If you’re coming from Windows as a newcomer to Linux, you probably know directories as folders. The mkdir command can do a few other things with directories as well.
time command in Linux with examples
The time command in Linux is like a stop watch built directly into your command line terminal. The time command is able to track how much time any command takes to finish executing. All you need to do is preface some command with the time command. Your command will execute as normal, but it will also show the duration of the command.
tee command in Linux with examples
Any Linux user that has spent enough time with the command line will eventually run into a scenario where they would like to redirect standard output and/or standard error to a file (or multiple files) as well as the terminal at the same time. For something so trivial, surely there’s a way to send our output to both places at the same time. And this is exactly what the tee command in Linux is used for.
tail command in Linux with examples
The tail command in Linux is one of the most essential commands you’ll need when viewing text files. If you’re a beginner to using the command line, the tail command is a good one to learn, along with the head command, which is sort of its opposite counterpart. tail is used to print the last 10 lines of multiple files or a specified file. tail, with it’s interesting and convenient functions, can be used to monitor changes that are made to files.