DEV Community

Luis Gomez
Luis Gomez

Posted on

Learning Terminal (Notes) Day #3

Exploring Our File's Content

Commands

  • head: Show us the first ten lines of any text file, if you want to see more than 10 lines you can use the parameter -n followed by the name of lines that you want.

  • tail: Like head show us a chunk of the text file but with the difference that show us the last 10 lines and you can use the parameter -n too.

  • less: Less show us the file in a interactive way by console, in this kind of view you can type / and type words that you want to find. Like a searching engine.

  • xdg-open: This command open a file with your Text Editor by Default

What is a command?

A command can be 4 things:

1- An Executable Program
2- An Shell's Utility
3- A Shell's function
4- An Alias

  • type: Describe us the type of command that you give, just type the command next to the command type. Example: type ls.

  • alias: With this we can create an alias for a specific command and make easy the task that we want to do Example: l="ls -lh" this gonna show a directory in list AND with a human lecture.

    WARNING: Alias are temporary, when you close the terminal and run a new one the alias is gonna disappear

  • help: Brings you information about how to use and works a command. Example: help cd.

  • man: Brings you an manual about command that you want to know. Example: man cd.

  • info: Works like man but with an different interface.

  • whatis: Show information about command but with less details.

Wildcards

Wildcards in summary is an advanced search using ls command.

How to use: Type the command and the special parameters that you want to get.

Example

To search for txt files

ls *.txt
The asterisk means all (I've seen that use asterisk to mean to all in computer science) and next you type the kind of file that you want.

There are a lot of functions with wildcards more information here.
There are too many uses for wildcards and depend your needs so I just gonna let the basics for now.

Top comments (0)