We recently talked about the Unix operating system and its various derivatives, such as Linux, and why it’s an invaluable skill to learn to assert your digital independence. If you know UNIX, you can use alternative operating systems such as Linux, run your own servers, and perform other powerful functions that reduce your dependence on software companies that provide user-friendly interfaces. Masu. We’ve also provided some ways to try Unix or Linux on your computer without making any major changes.
But accessing the command prompt can be daunting. There you will see a window or screen with mysterious characters and a creepy blinking cursor. What now?
It helps to know how to get around. Here are two basic commands for navigation:
- Type “pwd” and press Enter or Return to see the directory you are currently in.
- Run ls to list the contents of the directory
Think of pwd and ls as the compass and map of the Unix file system. It tells you where you are and what you’re looking at.
arguments and options
Almost all Unix commands accept arguments. No, it’s not like spending Thanksgiving with relatives. An argument in the Unix context means something extra to pass to a command. Often the file or directory on which the command operates.
Returning to the example above, if the ls command lists a familiar subdirectory such as “Documents,” you can enter that directory by typing cd followed by the directory name, such as “cd Documents.” can. In this example, Documents is an argument passed to the cd command.
Tip: On most Unix-type command lines, you can press the Tab key to autocomplete a file or directory name. So if you type “cd Doc” and then press the Tab key, you’ll get fewer errors and you won’t have to type as much.
get lost? Use cd ~ to return to your home directory. The home directory is the directory that starts by default when you open a command line window. You can also use cd .. to move up directories. An example is shown below.
- Let’s say you start at /Users/yourname/ (again, use the pwd command to find your home directory).
- Navigate to the Documents folder using cd Documents/ (pwd should show /Users/yourname/Documents).
- Type cd .. to return to /Users/yourname/.
Let’s discuss the options. Options are additional parameters passed to a command, usually indicated by a hyphen.
Let’s look at the ls command again. If you try it, you’ll probably see files and folders displayed in a series of columns. However, if you type ls -l instead, those files and folders will be displayed as a vertical list. -l is an example of an option.
By default, ls displays everything in alphabetical order. However, the option -t displays files and folders in the order they were last modified, with the most recent files listed first.
Options can be combined. Try ls -lt. Files and folders appear in the list in the order they were modified.
If you’re completely new to this concept, it’s going to keep you busy for a while. However, I would like to introduce you to some powerful Unix commands that will help you become independent in the digital realm.
it’s a man it’s a man
The man command is Unix’s built-in documentation system. You can pass other commands as arguments to man, such as man pwd and man ls. These commands have extensive manual pages for these commands. But how do you use the man command? It’s easy; just call man man and refer to the manual for man man.
The great thing about humans is that they are completely self-documenting. Need help navigating? Pressing h in the man application brings up a help screen with all the keyboard shortcuts, including how to exit the man page (press q).
A man page is typically laid out like this:
- Brief description of the command
- A quick overview of command arguments and options
- A detailed description of the command followed by an explanation of the options
Typically near the bottom of a manual page you will find examples and a list of related commands that you can explore.
But how do you navigate through manual pages and help screens? You can use the regular arrow keys and pgup and pgdown. The space also advances by one screen. However, if you want to learn Unix, I recommend getting familiar with VIM keys.
Navigate like VIM
VIM is a lightweight text editor for Unix, and we’ll talk about that another time, but its keyboard shortcuts are used in many Unix apps, such as man, so it’s worth learning.
(If you’re curious and have tried the VIM commands, but don’t know how to get out of it, just press :q!)
VIM’s ancestors were developed at a time when many keyboards didn’t have arrow keys, so developers had to get creative. For example, they decided that:
- j moves down
- k move up
These keyboard shortcuts work to move a single line up or down in Man. This is a neat trick. Pressing a number before j or k moves up or down that number of lines. So 5j moves down 5 rows.
Others include:
- z to move down one page
- w Move up one page
- g Move to the top of the manual page
- G moves to the end of the manual page
To search within a man page, press the forward slash (/) and then press your search term. Please note that it is case sensitive. For example, typing /System in man man displays results, but /system is not displayed.
- Press n to “Find Next”
- Press N to “Find Previous”
These shortcuts may seem silly or nerdy to learn, but they can greatly increase the power of Unix. Here’s a video of Luke Smith using VIM shortcuts to quickly rename files.
How vim makes your daily life easieryoutube.be
This is sufficient to refer to the man page. If you want to master VIM keys, try her VIMtutor command, which provides interactive tutorials.Online games are also recommended VIM Adventure If you prefer that approach.
You now know the basics of navigating the Unix file system, using the man command to get help, and navigating manual pages. With these building blocks, you can learn even more.





