Few basic things no one told you in ubuntu

Tram Ho

Previously when studying at school, there were some subjects I had to do homework with ubuntu. But also just know how to use. When you need to use reality I just know google search and copy one line at a time. After a period of use, I began to learn and understand something. None of this tells anyone, it feels like everyone knows because it’s so basic. And now I write articles that everyone knows.

1 File permissions

Nobody is any stranger to this chmod, but does anyone tell you what the 777 or 755 is. Probably not because no one has told me now. Like the default everyone knows. Then explain a bit. When you type ls -la or short called ll , you will get a list of files in directories like this.

You can see that the permissions section is drwxrwxrwx . The first is the format of file d is directory. Also there is l link, and a few other formats. And followed by 3 rwx clusters where r is read, w is write, x is execute. Each cluster will be a set of 3 bits with 1 to be enabled, 0 to disable. Obviously, if enabled the whole would be 111 = 7, or rx only for read and execute but not for write will be 101 = 5.

So 755 will be rwxr-xr-x , Now you know how to number when decentralized.

2 SSH key

When I first started working, I didn’t know anything about the server, I didn’t work on anything, just local code and pushed. But when I started to touch, I was told by TL to “send the ssh key to you to add”. Well and of course for a new guy, “what is the ssh key?”.

Basically, the ssh key is a private and public key pair that will be used instead of a password when ssh. I also did not go into the internal coding mechanism. You just need to give birth to this pair by:

And copy the contents of the file ~ / .ssh / id_rsa.pub to the server and you can ssh.

Also ssh key is also used when you authen into github and deploy key on server. Quite a lot of applications if you will find out.

3 Command pipe

When I did a task before, I checked out a new branch. Gradually, the local branch was a mile long, then they had to be deleted, but deleted one by one until tomorrow because we only knew the command to delete each branch one by one. First I try to find out if git has any command that clears all branches. And I found one like this:

And the magic here is the | sign , it will make the output of the previous statement become input in the following statement. If used, there are really many convenient tricks that this seal brings. For example, filtering a large log file only a few days ago:

Copy a series of files:

There are also a bunch of special marks that you probably will need. https://www.howtogeek.com/439199/15-special-characters-you-need-to-know-for-bash/

Share the news now

Source : Viblo