When working on the command line, quite often you will need to create or edit files. Two of the most famous and powerful command-line editors are Vim and emacs. On the other hand, they are equally difficult to learn. But there is a simpler editor available to just get things done and that is nano.
All commands are prefixed with a control(^) character or metacharacter(M). caret symbol represents control and M represents Meta. Control will generally be your control key. Meta character depends on the keyboard setup. It can either be an Esc key, alt key, or a special meta key.
In this video, I will help you learn the basic usage of the nano editor, including how to create an open file, edit a file, save a file, search and replace text, cut and paste text, and more.
If you wish to get more help, while inside nano editor hit: ^G
In this video, we will learn how to use less command. less is a command-line utility that displays the content of a file or a command output, one page at a time. The less command is mostly used for opening large files.
The general syntax for using less command is:
less [options] filename
It is also possible to use less with other commands output.
ls /etc | less
When opening a file that is too large to fit in one page, you will see the colon at the bottom of the screen. What makes less more appealing is its ease of file navigation.
In this video, we will learn how to use touch command. The main purpose of this command is to change file access and modification time but it can be used to create a new file. In simple terms, it is used to change the timestamp of a given file.
touch can create a new file too. I find it much simpler to create a new file using touch. It is possible to create a file with any file extension. Moreover, you can create multiple files with just one command.
Remember you can always type man touch to learn more about the command.
We will also learn about some flags along with touch command:
-t = pass in custom timestamp -a = just change access timestamp -m = just change the modified timestamp -r = copy timestamp from another file
In this video we will learn how to use stat command. stat is a command-line utility that displays detailed information about given files or file system. In simple words stat is used to display file information or properties.
Remeber you can always type man stat to learn more about the command.
We will also learn about some flags along with stat command:
-f = this flag is used for formatting custom output
In this video we will learn how to use alias and unalias command. alias are like custom shortcuts used to represent a command executed with or without custom options. You can save yourself some time by creating aliases for your most used commands.
Whereas unalias is used to remove the shortcut which was initially created. Pretty simle!