Principais comandos linux

Principais comandos linux

I started writing this post, in order, to help with the basic commands of linux, but I think the basic is a lot. So I’ll divide by categories it will first:

Manipulating files and folders

I intend to describe in this post, the commands that I believe to be the most useful in handling files for anyone who is starting on linux , with some parameters to make life easier. Anyone who thinks any more is needed, says, I add that in the post.

Listing files

using the command ls can list the files and folders ordered by modification date, by size, among others. We can also list only files, only folders or include links. Anyway, for more details see the documentation. man ls

Listing txt files, sorted by size

Listing png files, sorted by size in reverse order

Listing php files, sorted by modification date, in reverse order

Creating Files

There are several ways to create files in linux, including:

Touch

Cat

Using editor

You use your editor too, I like to use the nano , or peak as editor

Delete Files

Deleting files is easy, easy. Just use the command rm .

Deleting files for an extension

Deleting files without confirming

Using the-f argument, force will force the removal of the file.

Creating folder

As easy as the others, just use the command mkdir .

Creating folder with permission

Who ever heard of linux, ever heard the phrase “Linux has no viruses”. Well in my opnion .. a lie, but most of the reason is due to permissions management, linux will not describe it deeply, it will be another post in this series. Who uses a host with suPHP, must have seen a lot 500 internal server error . This occurs because the folder must have permission 755, and files 644 permission. To create a folder with permission, just use the option -m .

Create a folder recursively

did not like the name of this item, if anyone has any better, please comment. If you want to create a folder inside another that does not exist yet, you can create everything straight.

Removing folders

If you tried to remove a folder, you should have seen the error rm: can not remove “folder name”: is a directory . Simple to remove a folder, you have to remove it recursively. For this we will use the argument -r .

Remove folder without confirmation

Using the same command to “force” will add the -f

Moving files and folders

To move the command we use mv . In the example we will be moving the folder to public_html / home / vinicius

Renaming folders and files

The linux has no specific command to rename. Mv is used.

Modify permission

This item is here because it is directly related to this manipulation, but will again be discussed in more detail in a future post. Permission to change something, would use the chmod command.

recursively Permission

to give permission recursively , just add the option -r

Written by vinicius