The reference sheet for the top 99 Linux commands has been published. Get it here.
Author: Teach
Four Linux disk and file commands that aren’t that unique, and two important commands for finding content in command output or text files
Let us summarize four really basic commands, that are the same in Linux and Windows:
cd
– Change directory.
dir
– List directory contents.
mkdir
– Make a directory.
rmdir
– Remove a directory.
Now let us find specific words in command output
Okay, that much is clear. But during your daily work, you often want to find specific words from the output from other commands.
In Windows you would use the FindStr command as follows:
<command that prints output> | Findstr <search string>
But in Linux you will use grep.
<command that prints output> | grep <search string>
Let us find content in text files
But what if you want to find content in plain text files? Then you have the type command in Windows, and can use it as follows:
type <filename> | Findstr <search string>
In Linux you can use the cat command, as follows:
cat <filename> | grep <search string>
Curious to find out more about Linux network commands that are similar to Windows? Check this out.
Updates to the course – Your first Linux commands
See below for updates to the course material:
Lesson 4:
Updated for clarity with more information about file rights.
Added more information about file permissions.
Lesson 5:
Added clarification about syslog.
Added information about grep.
How Git fits into your Linux scripting process
When you begin to learn the basics of the Linux command line, you also find that you want to automate commands by gathering them in scripts. This will prove to be a valuable time-saver as you grow your Linux skills.
But when you have scripts that are longer than, say 20 lines, and you go back to modify and build on them, the complexity increases. Whether you are the only one working on and using the scripts, or if it is a team effort, you will want to use revision control. This helps you track changes to the scripts over time and can also save time so you don’t have to ask yourself, “What on earth was I thinking when I added command x?”
This is where Git comes in handy. Git is a distributed version control system. As such, you use it to track changes in computer files. It is often associated with developers and their toolset, but as the IT industry grows more concerned with durability and transparency, Git also becomes a useful tool for IT Operations staff and data scientists. Just to name a few.
Use Git to control changes and improve transparency
Even if you write and use your scripts exclusively, as your scripts begin numbering in the hundreds (not uncommon), you will find that you need to recall why some changes were made. Git comes to the rescue in this case. Of course, that depends on whether the git commit comments are descriptive and clear.
Read more about Git here (its homepage) and here (Wikipedia page).
Happy scripting! And go ahead and create your first git repository.