Go Back   Linux Forums by TotalPenguin! Get linux Help! > Linux > Linux General

Linux General Any questions that are not covered by other forums go here.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 02-22-2008, 11:09 PM
Off Off is offline
Member
 
Join Date: Feb 2008
Posts: 60
Off is on a distinguished road
Default sudo apt-get

My friends told me to run this command

sudo apt-get

When I wanted new software. But I type it and it does nothing other than ask for a password. What is this command? How do I use it better?
Reply With Quote

Sponsored Links
  #2 (permalink)  
Old 02-23-2008, 08:37 AM
Super Moderator
 
Join Date: Dec 2007
Location: Denmark
Posts: 273
v0id is on a distinguished road
Send a message via MSN to v0id
Default

It's two separate commands, or programs. You shall know that everything you type in the terminal is actually programs (and they're all located in the different directories, which $PATH specifies) sudo is used to run a command as root. You'll have to be root in order to install new software. You could also choose to first become root, using su, and then next run the command.
Code:
$ su
$ apt-get ...
Now to apt-get. apt-get is the packaging system used in Debian-based systems (including the *ubuntu-family.) It's used for easier installation of software, which normally can be hard on Linux. You can give apt-get, a lot of options, but I'll concentrate on one, the one for installation; install.
Code:
$ sudo apt-get install software
We let apt-get know, that we want to install some new software. software shall be the name of what you will install. So you shall not write software, but the name of the software you want to install. Let's say you want to install the popular FPS-game Sauerbraten. The only thing you've to do is:
Code:
$ sudo apt-get install sauerbraten
Now, apt-get will handle the process, and you don't have to do anything. To remove it again, you'll need to replace the install with remove instead. You shall also note that you can't find all the software you want using apt-get, but you can find a lot for sure. You can use apt-cache to search for available packages. You don't have to be root to use apt-cache, as you're not going to install anything.
Code:
$ apt-cache search sauerbraten
You'll now get a whole list of packages related to Sauerbraten. You can also use another keyword, like game, for finding other games.

As you may noticed about apt-get, there's a little problem. You've no control on precisely what to install, and where to install it. If you want or need this control, you'll need to install the software by the sourcecode. It's slightly more complicated, but the plus is; you'll get the control. Another user asked about the same thing some days ago, and you can find my response in the thread, which is located right here: http://www.totalpenguin.com/forum/showthread.php?t=1149
Reply With Quote
  #3 (permalink)  
Old 02-23-2008, 04:40 PM
Off Off is offline
Member
 
Join Date: Feb 2008
Posts: 60
Off is on a distinguished road
Default

Wow, informative post! Thank you for the reply. I don't understand the root system though. Why do I need to sudo to root to run a command? I think I understand the apt-get after playing around with it and reading your post.
Reply With Quote
  #4 (permalink)  
Old 02-23-2008, 05:01 PM
Super Moderator
 
Join Date: Dec 2007
Location: Denmark
Posts: 273
v0id is on a distinguished road
Send a message via MSN to v0id
Default

I'm glad you liked my post.

You've probably heard that everything in Linux is basically a file. And all these files each have a permission. The permission specifies who is able to read, execute, write, etc. to and from the file. As root, you're able to do everything with every file on the system without thinking about the permissions. That's why you need to be root in order to use apt-get. apt-get will read and write from files and directories which most likely all have limited permissions for the normal user.

There's much more in apt-get than I just told you. It's very complex, and it cannot be described in few words. I'll suggest you to check the man-page for apt-get, and eventually, pass the parameter --help to apt-get, for usage-help.
Code:
# Check out the man-page
$ man apt-get
Code:
# Get help to apt-get
$ apt-get --help
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 03:17 AM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.