Бормотухи.НЕТ

Вернуться   Бормотухи.НЕТ > Компьютеры > Операционные системы > Linux
Расширенный поиск

Ответ
 
Опции темы Поиск в этой теме
Старый 22.01.2011, 17:19 Вверх   #1
Уважаемая личность
 
Аватар для foozzi
foozzi вне форума
Доп. информация
По умолчанию Учимся работать в консоли

Прочитав название статьи, не спешите кричать, что в консоли Вы уже работали и все знаете. Консоль в Линуксе — это не только инструмент для установки программ. Это ... это все. Это и есть Линукс. Дело в том, что в отличие от Windows, где на данный момент главным интерфейсом является графический, для линукса вывод всех данных в терминальном режиме и есть основной интерфейс. В этом и есть его преимущество. Как это темное окно может заменить нам привычный оконный графический интерфейс? Да ведь там невозможно ничего делать! Ошибаетесь. В консоли можно делать все =) И чаще всего все действия там получаются намного быстрее. Только тут надо оговориться: все действия получаются быстрее, если ты до этого проделывал их уже несколько раз =)

Итак, поехали.

Первое, о чем хочется сказать. К любой команде консоли есть помощь. Выводится она даобавлением ключа --help, пример:

som32@som32-desktop:~$ apt-get --help
apt 0.7.6ubuntu14 for i386 compiled on Oct 15 2007 20:39:10
Usage: apt-get [options] command
apt-get [options] install|remove pkg1 [pkg2 ...]
apt-get [options] source pkg1 [pkg2 ...]

apt-get is a simple command line interface for downloading and
installing packages. The most frequently used commands are update
and install.

Commands:
update - Retrieve new lists of packages
upgrade - Perform an upgrade
install - Install new packages (pkg is libc6 not libc6.deb)
remove - Remove packages
purge - Remove and purge packages
source - Download source archives
build-dep - Configure build-dependencies for source packages
dist-upgrade - Distribution upgrade, see apt-get(8)
dselect-upgrade - Follow dselect selections
clean - Erase downloaded archive files
autoclean - Erase old downloaded archive files
check - Verify that there are no broken dependencies

Options:
-h This help text.
-q Loggable output - no progress indicator
-qq No output except for errors
-d Download only - do NOT install or unpack archives
-s No-act. Perform ordering simulation
-y Assume Yes to all queries and do not prompt
-f Attempt to continue if the integrity check fails
-m Attempt to continue if archives are unlocatable
-u Show a list of upgraded packages as well
-b Build the source package after fetching it
-V Show verbose version numbers
-c=? Read this configuration file
-o=? Set an arbitrary configuration option, eg -o dir::cache=/tmp
See the apt-get(8), sources.list(5) and apt.conf(5) manual
pages for more information and options.
This APT has Super Cow Powers.

После прочтения этой краткой справки, Вы уже будете иметь некое представление о том, что делает данная команда и как с ней работать. Но не всегда этого хватает, иногда требуется полнота картины. Тут нам на помощь приходит команда man.

NAME
apt-get - APT package handling utility -- command-line interface

SYNOPSIS
apt-get [-hvs] [-o=config string] [-c=file] {[update] | [upgrade] |
[dselect-upgrade] | [install pkg...] | [remove pkg...] |
[purge pkg...] | [source pkg...] | [build-dep pkg...] | [check]
| [clean] | [autoclean] | [autoremove]}

DESCRIPTION
apt-get is the command-line tool for handling packages, and may be
considered the user’s "back-end" to other tools using the APT library.
Several "front-end" interfaces exist, such as dselect(8), aptitude,
synaptic, gnome-apt and wajig.

Unless the -h, or --help option is given, one of the commands below
must be present.

update
update is used to resynchronize the package index files from their
sources. The indexes of available packages are fetched from the
location(s) specified in /etc/apt/sources.list. For example, when
using a Debian archive, this command retrieves and scans the
Packages.gz files, so that information about new and updated
packages is available. An update should always be performed before
an upgrade or dist-upgrade. Please be aware that the overall
progress meter will be incorrect as the size of the package files
cannot be known in advance.

upgrade
upgrade is used to install the newest versions of all packages
currently installed on the system from the sources enumerated in
/etc/apt/sources.list. Packages currently installed with new
versions available are retrieved and upgraded; under no
circumstances are currently installed packages removed, or packages
not already installed retrieved and installed. New versions of
currently installed packages that cannot be upgraded without
changing the install status of another package will be left at
their current version. An update must be performed first so that
apt-get knows that new versions of packages are available.

dselect-upgrade
dselect-upgrade is used in conjunction with the traditional Debian
packaging front-end, dselect(8). dselect-upgrade follows the
changes made by dselect(8) to the Status field of available
packages, and performs the actions necessary to realize that state
(for instance, the removal of old and the installation of new
packages).

dist-upgrade
dist-upgrade in addition to performing the function of upgrade,
also intelligently handles changing dependencies with new versions
of packages; apt-get has a "smart" conflict resolution system, and
it will attempt to upgrade the most important packages at the
expense of less important ones if necessary. The
/etc/apt/sources.list file contains a list of locations from which to retrieve desired package files. See also apt_preferences(5) for
a mechanism for overriding the general settings for individual
packages.

install
install is followed by one or more packages desired for
installation. Each package is a package name, not a fully qualified
filename (for instance, in a Debian GNU/Linux system, libc6 would
be the argument provided, not libc6_1.9.6-2.deb) All packages
required by the package(s) specified for installation will also be
retrieved and installed. The /etc/apt/sources.list file is used to
locate the desired packages. If a hyphen is appended to the package
name (with no intervening space), the identified package will be
removed if it is installed. Similarly a plus sign can be used to
designate a package to install. These latter features may be used
to override decisions made by apt-get’s conflict resolution system.

A specific version of a package can be selected for installation by
following the package name with an equals and the version of the
package to select. This will cause that version to be located and
selected for install. Alternatively a specific distribution can be
selected by following the package name with a slash and the version
of the distribution or the Archive name (stable, testing,
unstable).

Both of the version selection mechanisms can downgrade packages and
must be used with care.

Finally, the apt_preferences(5) mechanism allows you to create an
alternative installation policy for individual packages.

If no package matches the given expression and the expression
contains one of ’.’, ’?’ or ’*’ then it is assumed to be a POSIX
regular expression, and it is applied to all package names in the
database. Any matches are then installed (or removed). Note that
matching is done by substring so ’lo.*’ matches ’how-lo’ and
’lowest’. If this is undesired, anchor the regular expression with
a ’^’ or ’$’ character, or create a more specific regular
expression.

remove
remove is identical to install except that packages are removed
instead of installed. If a plus sign is appended to the package
name (with no intervening space), the identified package will be
installed instead of removed.

purge
purge is identical to remove except that packages are removed and
purged.

source
source causes apt-get to fetch source packages. APT will examine
the available packages to decide which source package to fetch. It
will then find and download into the current directory the newest
available version of that source package. Source packages are
tracked separately from binary packages via deb-src type lines in
the sources.list(5) file. This probably will mean that you will not
get the same source as the package you have installed or as you...


и так далее. Как видите, описание здесь уже намного подробнее, чаще всего его хватает для любых действий, но если вопросы возникают — форумы Вам в помощь =)


Команды без которых жить никак нельзя:

cd — команда для смены директории. Примеры:

cd Desktop

переведет Вас в папку Desktop, а

cd ..

на уровень выше.

cd ~ или просто cd

доставит Вас в домашнюю папку.


ls выведет вам все файлы и папки в данной директории.

ls Desktop


touch создаст файл

touch test.txt


rm удалит файл

rm test.txt


mkdir создаст директорию

mkdir Test


rm -r удалит директорию

rm -r Test


cp скопирует файл

cp test1.txt test2.txt


cp -r скопирует директорию

cp -r Test Test2


mv переместит файл или переименует его

mv test1.txt test2.txt

переименовывает test1.txt в test2.txt

mv test1.txt Test

переносит test1.txt в каталог Test

Это был список основных команд, зная их и общий принцип работы в консоли, освоить любую другую проблемы не составит.

Чтобы запустить программу из консоли есть 2 пути:

знать ее название:

opera


или знать точный адрес исполняемого файла

/usr/lib/opera/9.5*/opera

Тут я использовал символ * (звездочка). Это маркер автодополнения. Т.е. будут найдены все директории, названия которых начинаются с 9.5 не зависимо от того, какой у них конец имени.

Это были основные шаги в работе с консолью. Я естественно не призываю Вас отказываться от графического интерфейса в пользу консоли, но и забывать про такой мощнейший инструмент работы с компьютером не стоит.
  Ответить с цитированием
2 пользователя(ей) сказали cпасибо:
Ответ

Опции темы Поиск в этой теме
Поиск в этой теме:

Расширенный поиск

Ваши права в разделе
Вы не можете создавать новые темы
Вы не можете отвечать в темах
Вы не можете прикреплять вложения
Вы не можете редактировать свои сообщения

BB коды Вкл.
Смайлы Вкл.
[IMG] код Вкл.
HTML код Выкл.

Быстрый переход

Похожие темы
Тема Автор Раздел Ответов Последнее сообщение
Скачать Разные консоли no name Игровые консоли 3 20.11.2016 02:20
[Инструкция] Учимся качать с трекеров CraSTIX Интернет 2 21.04.2011 20:26
[Инструкция] Команды консоли Ubuntu foozzi Linux 0 22.01.2011 02:01
Учимся флиртовать (для прекрасной половины) Serberg Психология взаимоотношений 2 21.03.2009 21:12
Учимся создавать собственный аватар ghostrid3r Уроки Photoshop 7 15.02.2009 12:27


Текущее время: 05:46. Часовой пояс GMT +3.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc. Перевод: zCarot
 

Время генерации страницы 0.10917 секунды с 12 запросами