8

I tried installing PlayOnLinux by using the steps according to a YouTube video, Install MS Office 2010 on Ubuntu 12.04-14.04, and used the command

sudo apt-get install curl

Then it requested my password which I entered.

Can anyone please explain what this command line does?

2
  • 31
    It is usually a bad idea to execute commands randomly found on the Internet without understanding what they're doing, especially when they start with sudo. Good answers below, but you should have asked before running it. – Calimo Apr 30 '15 at 9:45
  • Note: instead of apt-get you can just use apt. It provides a simpler interface and nicer output. Or just use a visual package manager. – Bakuriu May 1 '15 at 6:16
29

First let's look at each part of the command individually:

  1. sudo is short for "substitute user do" and executes commands as another user. Most commonly, it is used to temporarily become "root" (Linux equivalent of admin). Software installation would not work without sudo in the front. This is the part of the command that needs your password. For security reasons, you should always try to use sudo rather than straight-up logging in as root.

  2. apt-get is one program in the apt suite, which deals with software installation and management. Linux distributions typically feature a package manager that is used to install, configure, and remove software; Ubuntu uses apt as described here.

  3. install tells apt-get to install a package on your computer. The command will search through your repositories (typically just the official Ubuntu repositories via the internet) for a package, download it, copy it to your computer, and configure it. For more specifics see this question.

  4. curl tells apt-get what package to install. Specifically, curl is a data transfer program, and is commonly used to download websites or files via the command line. More details available on its manpage.

So, putting everything together, you are going to download the package curl from the internet and install it by giving the apt-get program root privileges.

As Calimo noted in his comment, you should be careful executing random terminal commands you find on the internet. And you should be VERY careful executing any command that starts with sudo, since it has the potential to damage the really important parts of your system.

11
  • 5
    Actually sudo is short for 'substitute user do' - though it's frequently used to do something as root, that's not it's only use, you can also do things as any other user you have a password for. – Rich Bradshaw Apr 30 '15 at 13:19
  • @RichBradshaw The sudo man page mentions "superuser" once, and "substitute," not at all. linux.die.net/man/8/sudo – Aaron Hall Apr 30 '15 at 16:41
  • Thats interesting, I'd assumed it came from Su, which definitely is substitute: linux.die.net/man/1/su – Rich Bradshaw Apr 30 '15 at 16:47
  • 2
    "execute a command as the superuser or another user" I think the main usage is to execute commands as a superuser, and thus it stands for Super user do only. We don't tell sudo to substitute the user for root. But with additional options, we can make it run commands on behalf of another user too. – user3459110 Apr 30 '15 at 21:47
  • 1
    Regarding "substitute user do" versus "super user do": en.wikipedia.org/wiki/… – Ergwun May 1 '15 at 4:55
9

man curl

curl is a tool to transfer data from or to a server, using one of the supported protocols (DICT, FILE, FTP, FTPS, GOPHER, HTTP, HTTPS, IMAP, IMAPS, LDAP, LDAPS, POP3, POP3S, RTMP, RTSP, SCP, SFTP, SMTP, SMTPS, TELNET and TFTP). The command is designed to work without user inter‐ action.

This is curl.

The command sudo apt-get install curl means you are going to download and install curl into your system.

So when you use sudo and every time you use sudo you will be asked for your password to ensure that you have permissions to do things for your system

Read this and this for more information about sudo.

0

whenever you use a command starting with sudo, it means that you are using the computer as a root privileged. And every command that make change to a computer should start with sudo because Linux needs to make sure the administrator is making those changes. you can also prompt a sudo sucommand before any other commands. so that you do not need to enter your pass-phrase every time you want to change the computer settings.

0

Running a sudo someCommand will not even check if that command exists/is valid/in the PATH. The moment the shell sees sudo, it will prompt for a password.

Not the answer you're looking for? Browse other questions tagged or ask your own question.