个人工具

“UbuntuHelp:SwitchingToUbuntu/FromLinux”的版本间的差异

来自Ubuntu中文

跳转至: 导航, 搜索
 
(未显示同一用户的5个中间版本)
第2行: 第2行:
 
{{Languages|UbuntuHelp:SwitchingToUbuntu/FromLinux}}
 
{{Languages|UbuntuHelp:SwitchingToUbuntu/FromLinux}}
 
#title Switching to Ubuntu from other Linux/UNIX distributions
 
#title Switching to Ubuntu from other Linux/UNIX distributions
Many people who use Unix-like Operating Systems make the switch to Ubuntu everyday and even more are considering it. This page shows the Ubuntu equivalents of many traditional Unix applications,and tasks.  
+
This page discusses practical differences between Ubuntu and other Linux distributions. See also the [[UbuntuHelp:SwitchingToUbuntu/|all-systems switching guide]].  If you are switching from Mac OS X, see [[UbuntuHelp:SwitchingToUbuntu/FromMacOSX|switching from OS X]].
There are also specialized guides for users of [[UbuntuHelp:SwitchingToUbuntu/FromLinux/RedHatEnterpriseLinuxAndFedora|Red Hat/Fedora]] and [[UbuntuHelp:SwitchingToUbuntu/FromMacOSX|Mac OS X]].
+
Ubuntu is based on Debian, so many tasks are the same in Ubuntu as they are in Debian.
 +
== Installing Software ==
 +
Like all Debian-based distributions, software is installed in Ubuntu with ''APT''.  This is similar to ''yum'', which is used by !RedHat-based distributions.  If you prefer the command-line, you should install packages with `apt-get`.  Alternatively, ''System > Administration > Synaptic Package Manager'' is a graphical interface to APT.
 +
See [[UbuntuHelp:InstallingSoftware|Installing Software]] for information on installing packages.
 
== Performing Administrative Tasks ==
 
== Performing Administrative Tasks ==
Ubuntu handles the root user a little differently to most other Linux distributions in that it has the root account disabled by default. Instead Ubuntu uses the "sudo" program to allow users in the 'admin' group to run particular commands as root. Graphical config tools also prompt for your password using a similar system. This has many advantages:
+
In Ubuntu, you are recommended to run programs with `sudo` instead of logging in as root with `su`. Advantages of `sudo` include:
* You can't do anything really bad to your system unless you use sudo each time.
+
* You can't do anything really bad to your system unless you use `sudo` each time.
 
* You don't have to remember a root password - '''sudo only needs your own account's password.'''
 
* You don't have to remember a root password - '''sudo only needs your own account's password.'''
 
* sudo remembers for a limited time that you used your password, so you won't have to enter your password every time you use it.
 
* sudo remembers for a limited time that you used your password, so you won't have to enter your password every time you use it.
At first only the user you create during installation will have access to sudo. To allow additional users to use sudo, add them to the ''admin'' group.
+
At first, only the user you create during installation will have access to sudo. To allow additional users to use sudo, add them to the ''admin'' group.
 
=== Using Sudo ===
 
=== Using Sudo ===
 
To run a command with root privileges, simply open a terminal and type:
 
To run a command with root privileges, simply open a terminal and type:
第15行: 第18行:
 
sudo <command>
 
sudo <command>
 
</nowiki></pre>
 
</nowiki></pre>
Replace ''<command>'' with the command you wish to use. Sudo will then ask for your '''normal user password'''; enter it and press ''return'' to run the command.
+
Replace `<command>` with the command you wish to use. Sudo will ask for your '''normal user password'''; enter it and press ''return'' to run the command.
Sudo also has a graphical mode, if you try to run a program from the menu system (such as Synaptic) that requires root privileges a dialog box will appear asking you to enter your '''normal user password'''. Enter your user password and click ''Continue'' or press the enter button on your keyboard.
+
Graphical equivalents to `sudo` include `gksudo` and `kdesudo`.  When one of these programs runs, a dialog box will appear asking you to enter your '''normal user password'''. Enter your user password and click ''Continue'' or press the enter button on your keyboard.
 
To run a proper root shell you can do the following:
 
To run a proper root shell you can do the following:
 
<pre><nowiki>
 
<pre><nowiki>
第22行: 第25行:
 
</nowiki></pre>
 
</nowiki></pre>
 
This will ask for your normal user password, enter it and you will be at the root prompt.  
 
This will ask for your normal user password, enter it and you will be at the root prompt.  
== Packaging ==
 
=== For Debian Users ===
 
Packages in Ubuntu can be handled the same way as in Debian using apt-get/synaptic/aptitude from the command line, or using the Synaptic or Gnome-app-install graphical installers.
 
Most of the Debian pool is available to Ubuntu users through the extra ''Universe'' and ''Multiverse'' repositories, which are not enabled on a default install (see [[UbuntuHelp:AddingRepositoriesHowto|AddingRepositoriesHowto]] to enable them). Optionally you can open ''/etc/apt/sources.list'' with your favorite editor and uncomment the relevant lines to enable the extra repositories.
 
Every six months a snapshot of Debian Unstable is made and Ubuntu is created from that. That said, installing packages made for Debian on your Ubuntu system can often cause problems due to the minor differences and tweaking the Ubuntu developers need to do to make Ubuntu stable - use Ubuntu's ''Universe'' and ''Multiverse'' repositories instead for you extra software needs.
 
See [[UbuntuHelp:InstallingSoftware|Installing Software]] for information on installing packages.
 
 
== Command Line configuration (aliases and inputrc) ==
 
== Command Line configuration (aliases and inputrc) ==
 
This section is written for Mandrake/Mandriva users, but probably applies generally.  
 
This section is written for Mandrake/Mandriva users, but probably applies generally.  
 
=== Useful Shell aliases ===
 
=== Useful Shell aliases ===
Mandriva defines the following aliases (in /etc/profile.d/alias.sh), which make the shell faster to use. They could also go in your .bashrc
+
Mandriva defines the following aliases in `/etc/profile.d/alias.sh`, which make the shell faster to use. They could also go in your `~/.bashrc`:
 
{|border="1" cellspacing="0"
 
{|border="1" cellspacing="0"
|alias ls='ls -F --color=auto'||make ls coloured, and append characters to denote filetype ( eg trailing / on directory names)
+
|`alias ls='ls -F --color=auto'` ||# make ls coloured, and append characters to denote filetype ( eg trailing / on directory names)
 
|-
 
|-
|alias l='ls'|| short for ls
+
|`alias l='ls'` ||short for ls
 
|-
 
|-
|alias l.='ls -d .*'||show only hidden files
+
|`alias l.='ls -d .*'` ||# show only hidden files
 
|-
 
|-
|alias la='ls -a'||list all files
+
|`alias la='ls -a'` ||# list all files
 
|-
 
|-
|alias ll='ls -l'||long format listing
+
|`alias ll='ls -l'` ||# long format listing
 
|-
 
|-
|alias lsd='ls -d */'||list only directories
+
|`alias lsd='ls -d */'` ||# list only directories
 
|-
 
|-
|alias lx='ls -X'||list, order by extension
+
|`alias lx='ls -X'` ||# list, order by extension
 
|-
 
|-
|alias p='cd -'||previous directory
+
|`alias p='cd -'` ||# previous directory
 
|-
 
|-
|alias s='cd ..'|| short for cd ..
+
|`alias s='cd ..'` ||# short for cd ..
 
|-
 
|-
|alias cd..='cd ..'||allow omission of space in cd ..
+
|`alias cd..='cd ..'` ||# allow omission of space in cd ..
 
|-
 
|-
|alias rd='rmdir'||
+
|`alias rd='rmdir'` ||# Remove a directory
 
|-
 
|-
|alias md='mkdir'||
+
|`alias md='mkdir'` ||# Make a directory
 
|}
 
|}
The following make cp,rm, and mv interactive by default, so you don't overwrite a file by mistake. Most people think this is useful, but some think it makes one careless, as one might come to rely upon the implicit -i, on some other system which doesn't have it.
+
The following make `cp`, `rm`, and mv interactive by default, so you don't overwrite a file by mistake. Most people think this is useful, but some think it makes one careless, as one might come to rely upon the implicit `-i`, on some other system which doesn't have it.
 
{|border="1" cellspacing="0"
 
{|border="1" cellspacing="0"
|alias mv='mv -i'
+
|`alias mv='mv -i'`
 
|-
 
|-
|alias rm='rm -i'  
+
|`alias rm='rm -i'`
 
|-
 
|-
|alias cp='cp -i'
+
|`alias cp='cp -i'`
 
|}
 
|}
 +
Note that these aliases ''do not work'' when running a command as root using sudo.  One workaround for this is to add `alias sudo="sudo "` to your `.bashrc` (note the extra space in the quotes).  This will allow the first word after 'sudo' to be substituted if an alias exists.<<FootNote(Source: https://lists.ubuntu.com/archives/ubuntu-users/2005-June/039274.html)>>
 
=== Tab Completion Enhancements ===
 
=== Tab Completion Enhancements ===
Mandriva defines the following in /etc/inputrc (it could also go in ~/.inputrc), which makes tab-completion much more pleasant. In Ubuntu/Debian/RedHat, when tab-completion has several possible alternatives, it simply beeps. In Mandriva, it prints the list of options and then repeats the prompt where you were.  Furthermore, the system beep is now rarer, and when it does beep, it's meaningful, rather than annoying.
+
Mandriva defines the following in `/etc/inputrc`, which prints the list of options and then repeats the prompt where you were:
 
<pre><nowiki>
 
<pre><nowiki>
 
set show-all-if-ambiguous on
 
set show-all-if-ambiguous on
 
</nowiki></pre>
 
</nowiki></pre>
 +
Putting this in `/etc/inputrc` or `~/.inputrc` will add this function to Ubuntu.
 
== Music, Movies, DVD Playback and Java ==
 
== Music, Movies, DVD Playback and Java ==
 
Getting file formats restricted by patents or copyright such as movies and music to play on your Ubuntu system is simple (although not as simple as it could be). See [[UbuntuHelp:RestrictedFormats|RestrictedFormats]]. [[UbuntuHelp:Java|Java]] is simple too.
 
Getting file formats restricted by patents or copyright such as movies and music to play on your Ubuntu system is simple (although not as simple as it could be). See [[UbuntuHelp:RestrictedFormats|RestrictedFormats]]. [[UbuntuHelp:Java|Java]] is simple too.
 +
== Services, Chkconfig and Initscripts ==
 +
Users of Red Hat and Mandriva will be used to configuring which services run by using `chkconfig` command.  `chkconfig` is not available in Ubuntu, but you can install `sysv-rc-conf` instead.
 +
To start and stop services, it's necessary to invoke the `init.d` script directly: `/etc/init.d/ssh start` rather than `service sshd start`.  If you want to have the 'service' syntax back, add this to root's .bashrc:
 +
<pre><nowiki>
 +
function service (){ /etc/init.d/$@ ;} 
 +
</nowiki></pre>
 +
Since Intrepid, you can also [[UbuntuHelp:InstallingSoftware#installing-a-package|install the following package]]: '''''[[UbuntuHelp:apt:sysvinit-utils|sysvinit-utils]]''''', which provides the `service` command.
 +
Ubuntu runs in runlevel 3 by default, whereas !RedHat and Mandriva use runlevel 5 for graphics, and 3 for console. Ubuntu also has an ''extra'' rcX.d  directory, `/etc/rcS.d`, which runs at boot-up.  Packages like `udev` are started from `rcS.d`. There are some helpful README files in the `/etc/rcX.d` directories.
 
== Environment Variables ==
 
== Environment Variables ==
 
See [[UbuntuHelp:EnvironmentVariables|Environment Variables]] for a full guide to the use of environment variables in Ubuntu.
 
See [[UbuntuHelp:EnvironmentVariables|Environment Variables]] for a full guide to the use of environment variables in Ubuntu.
第77行: 第84行:
 
There are a few good resources you can turn to if you need further help with Ubuntu, these include:
 
There are a few good resources you can turn to if you need further help with Ubuntu, these include:
 
* http://help.ubuntu.com - The main source of Ubuntu documentation
 
* http://help.ubuntu.com - The main source of Ubuntu documentation
* Press '''System -> Help and Support''' to access the system documentation
+
* [http://www.ubuntuforums.org Forums], [http://lists.ubuntu.com mailing lists] and IRC (irc.freenode.net - #ubuntu)
* Man and info pages on your system
+
* [http://www.ubuntuforums.org Forums], [http://lists.ubuntu.com Mailing Lists] and IRC (irc.freenode.net - #ubuntu)
+
----
+
[[category:CategoryCleanup]]
+
  
 
[[category:UbuntuHelp]]
 
[[category:UbuntuHelp]]

2009年11月17日 (二) 20:43的最新版本

  1. title Switching to Ubuntu from other Linux/UNIX distributions

This page discusses practical differences between Ubuntu and other Linux distributions. See also the all-systems switching guide. If you are switching from Mac OS X, see switching from OS X. Ubuntu is based on Debian, so many tasks are the same in Ubuntu as they are in Debian.

Installing Software

Like all Debian-based distributions, software is installed in Ubuntu with APT. This is similar to yum, which is used by !RedHat-based distributions. If you prefer the command-line, you should install packages with `apt-get`. Alternatively, System > Administration > Synaptic Package Manager is a graphical interface to APT. See Installing Software for information on installing packages.

Performing Administrative Tasks

In Ubuntu, you are recommended to run programs with `sudo` instead of logging in as root with `su`. Advantages of `sudo` include:

  • You can't do anything really bad to your system unless you use `sudo` each time.
  • You don't have to remember a root password - sudo only needs your own account's password.
  • sudo remembers for a limited time that you used your password, so you won't have to enter your password every time you use it.

At first, only the user you create during installation will have access to sudo. To allow additional users to use sudo, add them to the admin group.

Using Sudo

To run a command with root privileges, simply open a terminal and type:

sudo <command>

Replace `<command>` with the command you wish to use. Sudo will ask for your normal user password; enter it and press return to run the command. Graphical equivalents to `sudo` include `gksudo` and `kdesudo`. When one of these programs runs, a dialog box will appear asking you to enter your normal user password. Enter your user password and click Continue or press the enter button on your keyboard. To run a proper root shell you can do the following:

sudo -i

This will ask for your normal user password, enter it and you will be at the root prompt.

Command Line configuration (aliases and inputrc)

This section is written for Mandrake/Mandriva users, but probably applies generally.

Useful Shell aliases

Mandriva defines the following aliases in `/etc/profile.d/alias.sh`, which make the shell faster to use. They could also go in your `~/.bashrc`:

`alias ls='ls -F --color=auto'` # make ls coloured, and append characters to denote filetype ( eg trailing / on directory names)
`alias l='ls'` # short for ls
`alias l.='ls -d .*'` # show only hidden files
`alias la='ls -a'` # list all files
`alias ll='ls -l'` # long format listing
`alias lsd='ls -d */'` # list only directories
`alias lx='ls -X'` # list, order by extension
`alias p='cd -'` # previous directory
`alias s='cd ..'` # short for cd ..
`alias cd..='cd ..'` # allow omission of space in cd ..
`alias rd='rmdir'` # Remove a directory
`alias md='mkdir'` # Make a directory

The following make `cp`, `rm`, and mv interactive by default, so you don't overwrite a file by mistake. Most people think this is useful, but some think it makes one careless, as one might come to rely upon the implicit `-i`, on some other system which doesn't have it.

`alias mv='mv -i'`
`alias rm='rm -i'`
`alias cp='cp -i'`

Note that these aliases do not work when running a command as root using sudo. One workaround for this is to add `alias sudo="sudo "` to your `.bashrc` (note the extra space in the quotes). This will allow the first word after 'sudo' to be substituted if an alias exists.<<FootNote(Source: https://lists.ubuntu.com/archives/ubuntu-users/2005-June/039274.html)>>

Tab Completion Enhancements

Mandriva defines the following in `/etc/inputrc`, which prints the list of options and then repeats the prompt where you were:

set show-all-if-ambiguous on

Putting this in `/etc/inputrc` or `~/.inputrc` will add this function to Ubuntu.

Music, Movies, DVD Playback and Java

Getting file formats restricted by patents or copyright such as movies and music to play on your Ubuntu system is simple (although not as simple as it could be). See RestrictedFormats. Java is simple too.

Services, Chkconfig and Initscripts

Users of Red Hat and Mandriva will be used to configuring which services run by using `chkconfig` command. `chkconfig` is not available in Ubuntu, but you can install `sysv-rc-conf` instead. To start and stop services, it's necessary to invoke the `init.d` script directly: `/etc/init.d/ssh start` rather than `service sshd start`. If you want to have the 'service' syntax back, add this to root's .bashrc:

function service (){ /etc/init.d/$@ ;}  

Since Intrepid, you can also install the following package: sysvinit-utils, which provides the `service` command. Ubuntu runs in runlevel 3 by default, whereas !RedHat and Mandriva use runlevel 5 for graphics, and 3 for console. Ubuntu also has an extra rcX.d directory, `/etc/rcS.d`, which runs at boot-up. Packages like `udev` are started from `rcS.d`. There are some helpful README files in the `/etc/rcX.d` directories.

Environment Variables

See Environment Variables for a full guide to the use of environment variables in Ubuntu.

Documentation

There are a few good resources you can turn to if you need further help with Ubuntu, these include: