The commands on ubuntu (80%) – part 1

Tram Ho

“How should a programmer buy a configuration machine?”

“I am learning to code, how should I buy a configuration machine?”

“Which operating system should a developer use?”

….

There are countless other questions for the generations that have gone through coding. With the first 2 questions, the answer I’ve ever heard is that as long as I have a computer that can note and access the internet to learn, I can use it. However, depending on the conditions, you can buy a good and weak device (it’s preferable to use a high-end model, but if you have a computer you can learn to code) Why is the cloud full now, almost all services are oriented to cloud deployment such as Word, excel, drive …. bla bla. So if you ask if the abcxyz configuration machine is enough to learn to code, you should instead ask if you are eligible to buy it. If you have enough money, you can buy a 40-year-old gaming device to see if you want to buy the hut.

As for the question of which operating system, I suggest using ubuntu (or a relative of linux – ubuntu potassium is typical). Well if possible, use the macbook code. Oh forget to show that my friend just bought a 2016 Mac you borrowed to help me feel cool) Why? So because most of the servers are currently using the linux family operating system. If using the same server as the best, but also the smoothest. As I am currently doal boot which is actually three boot both windown, ubuntu and potassium. I set ubuntu as default, so when I go to ubuntu it’s always war. Rarely return to win, only when occasionally writing standard doc, then come back to win, but whenever they come back to win, then it screams, lag lag doesn’t leave anywhere. But if she is too beautiful, to dabble in her neighbor’s house, is she pretty)

See, you see all the advantages of the operating system of that depressing linux family. What are you waiting for. Then in this post, I will do 1 to 2 articles and collect them learn in 20% of the time the 80% about 80% of the common commands. These articles will not try to try everything command everything because it has too many, and I will aim to ubuntu. Let go


man

This is the first command I want to introduce, it is a command that helps you understand all the other commands. Syntax man <command> – where command is the command you need to learn.

Above is the explanation of man command with the syntax man man

Above is an explanation of the ls command that contains syntax and options

Also you can learn the commands more quickly and easier to understand by searching for the command in this page tldr This page I think is very easy to understand.

ls

This is a command that allows you to list files and folders in a given path. Syntax: ls path-to-folder

This command allows several options. However, one of the most commonly used option is ls -la path-to-file which allows to get information about all files and folders including hidden files and permissions of files.

The information includes:

  • file permissions
  • number of links to the file
  • ower of the file
  • group of files
  • file size (bytes)
  • modified datetime file
  • file name (hidden files will have accents.

CD

This is the command that allows to change the current working directory.

pwd

With a command line interface like ubuntu there will be times when you will forget where you stand. Then this command will help you know where you are standing. Syntax: pwd

But that seems not enough if you do not install support, the interface will look like this:

So you can’t forget to press pwd every time. no no =)) You should install this additional support: Z-shell . You will have an interface as above that always has the current path and will have many other suggestions for you to find out yourself.

mkdir

You can create folders using this command. Syntax: mkdir path-to-folder1 path-to-folder2 path-to-folder3

You can also create multiple folders with subfolders inside by adding the: -p option

rmdir

The statement above is the create statement, it is now the delete statement. This command is used to delete folders as long as the folders are empty and do not contain any files (avoid deleting by mistake). Syntax: rmdir path-to-file

But if I like to delete it, is it okay? Okay, why not. Well, I like to use this command, allowing it to fly straight. rm -rf path-to-file

mv

This command is a command that allows you to move a file to a new path or to rename the file. Syntax: mv path-to-file path-to-new

cp

This command allows you to copy a file to a certain path. Syntax: cp path-to-file path-to-new-folder

To copy folders, use the -r option: cp -r path-to-file path-to-new-folder

touch

This command is used to create an empty file. Syntax: touch <file>

If this file already exists, the file will be in write mode and the timesamp will be updated immediately.

find

find command can be used to search for flie or folders matching keyword available in the system – search even in subfolders. Syntax: find path keyword options

Learn through a few examples:

  • To search all files with the extension “.js” and print the relative path of the files: find / -name "*.js" .

And this is the consequence, fortunately if we press quickly or else the result is very long)

  • Search for directories (-type d) abbreviated to directory, named src: find / -type d -name src

  • Search in multiple directories

  • Search with multiple -or conditions:

  • Search for files with more than 100 bytes:

  • Search for files that have been edited in the last 24 hours:

and so on and clouds. You can find out more options by the man command.


Done. This is part 1 offline. I will back this series later. You welcome to read part 2 link here. Thank you for your interest

Share the news now

Source : Viblo