Linux

Основы Linux и команды.
Слева панель навигации.

Основы Команды Linux

Навигация в система

Для работы в OC Linux используются команды, которые помогают пользователю взаимодействовать с системой не только визуальным путём как мы привыкли в Windows, но и с помощью команд. Команды дадут вам консольный вариант представления чего-то графического, но в этом ничего страшного нет, не пугайтесь.

Пойдём по порядку для начала нам нужно понять как можно взаимодействовать с системой, как понять где мы и как понять что мы можем.
В данном разделе мы ознакомимся с командами
  • help
  • man
  • history
  • clean
  • ls.

Примечание чтоб открыть терминал вы можете воспользоваться графической оболочкой если она есть или используйте сочетание клавиш CTRL + ALT + T.
Команда help

help: Предоставляет информацию только для встроенных команд Bash.


Команда help используется для получения краткой справочной информации о встроенных командах оболочки (builtin commands) Bash. Эти команды являются частью самой оболочки и не имеют отдельных исполняемых файлов.

Команда Аргумент1 Аргумент 2 .....
В зависимости от команды количество аргументов и флагов может быть разное. Нам дали совет используйте команду help name. Чтоб подробно узнать про команду name.
$ help
GNU bash, version 5.2.21(1)-release (x86_64-pc-linux-gnu)
These shell commands are defined internally.  Type `help' to see this list.
Type `help name' to find out more about the function `name'.
Use `info bash' to find out more about the shell in general.
Use `man -k' or `info' to find out more about commands not in this list.

A star (*) next to a name means that the command is disabled.

 job_spec [&]                                                                              history [-c] [-d offset] [n] or history -anrw [filename] or history -ps arg [arg...]
 (( expression ))                                                                          if COMMANDS; then COMMANDS; [ elif COMMANDS; then COMMANDS; ]... [ else COMMANDS; ] fi
 . filename [arguments]                                                                    jobs [-lnprs] [jobspec ...] or jobs -x command [args]
 :                                                                                         kill [-s sigspec | -n signum | -sigspec] pid | jobspec ... or kill -l [sigspec]
 [ arg... ]                                                                                let arg [arg ...]
 [[ expression ]]                                                                          local [option] name[=value] ...
 alias [-p] [name[=value] ... ]                                                            logout [n]
 bg [job_spec ...]                                                                         mapfile [-d delim] [-n count] [-O origin] [-s count] [-t] [-u fd] [-C callback] [-c qu>
 bind [-lpsvPSVX] [-m keymap] [-f filename] [-q name] [-u name] [-r keyseq] [-x keyseq:s>  popd [-n] [+N | -N]
 break [n]                                                                                 printf [-v var] format [arguments]
 builtin [shell-builtin [arg ...]]                                                         pushd [-n] [+N | -N | dir]
 caller [expr]                                                                             pwd [-LP]
 case WORD in [PATTERN [| PATTERN]...) COMMANDS ;;]... esac                                read [-ers] [-a array] [-d delim] [-i text] [-n nchars] [-N nchars] [-p prompt] [-t ti>
 cd [-L|[-P [-e]] [-@]] [dir]                                                              readarray [-d delim] [-n count] [-O origin] [-s count] [-t] [-u fd] [-C callback] [-c >
 command [-pVv] command [arg ...]                                                          readonly [-aAf] [name[=value] ...] or readonly -p
 compgen [-abcdefgjksuv] [-o option] [-A action] [-G globpat] [-W wordlist] [-F function>  return [n]
 complete [-abcdefgjksuv] [-pr] [-DEI] [-o option] [-A action] [-G globpat] [-W wordlist>  select NAME [in WORDS ... ;] do COMMANDS; done
 compopt [-o|+o option] [-DEI] [name ...]                                                  set [-abefhkmnptuvxBCEHPT] [-o option-name] [--] [-] [arg ...]
 continue [n]                                                                              shift [n]
 coproc [NAME] command [redirections]                                                      shopt [-pqsu] [-o] [optname ...]
 declare [-aAfFgiIlnrtux] [name[=value] ...] or declare -p [-aAfFilnrtux] [name ...]       source filename [arguments]
 dirs [-clpv] [+N] [-N]                                                                    suspend [-f]
 disown [-h] [-ar] [jobspec ... | pid ...]                                                 test [expr]
 echo [-neE] [arg ...]                                                                     time [-p] pipeline
 enable [-a] [-dnps] [-f filename] [name ...]                                              times
 eval [arg ...]                                                                            trap [-lp] [[arg] signal_spec ...]
 exec [-cl] [-a name] [command [argument ...]] [redirection ...]                           true
 exit [n]                                                                                  type [-afptP] name [name ...]
 export [-fn] [name[=value] ...] or export -p                                              typeset [-aAfFgiIlnrtux] name[=value] ... or typeset -p [-aAfFilnrtux] [name ...]
 false                                                                                     ulimit [-SHabcdefiklmnpqrstuvxPRT] [limit]
 fc [-e ename] [-lnr] [first] [last] or fc -s [pat=rep] [command]                          umask [-p] [-S] [mode]
 fg [job_spec]                                                                             unalias [-a] name [name ...]
 for NAME [in WORDS ... ] ; do COMMANDS; done                                              unset [-f] [-v] [-n] [name ...]
 for (( exp1; exp2; exp3 )); do COMMANDS; done                                             until COMMANDS; do COMMANDS-2; done
 function name { COMMANDS ; } or name () { COMMANDS ; }                                    variables - Names and meanings of some shell variables
 getopts optstring name [arg ...]                                                          wait [-fn] [-p var] [id ...]
 hash [-lr] [-p pathname] [-dt] [name ...]                                                 while COMMANDS; do COMMANDS-2; done
 help [-dms] [pattern ...]                                                                 { COMMANDS ; }
Команда help (Аргумент)
help ls - например мы вызовем помощь по команде списка и вы увидите, что нам система говорит извините но особо информации нет, лучше используйте команду man для руководства.

help cd - здесь же мы видим что у нас есть помощник по базовым аргументов для команды.

Поэтому вы можете проверять как правильно писать и использовать команды.
$ help ls                                                                                                                                                                          
bash: help: no help topics match `ls'.  Try `help help' or `man -k ls' or `info ls'.

$ help cd
cd: cd [-L|[-P [-e]] [-@]] [dir]
    Change the shell working directory.
    
    Change the current directory to DIR.  The default DIR is the value of the
    HOME shell variable. If DIR is "-", it is converted to $OLDPWD.
    
    The variable CDPATH defines the search path for the directory containing
    DIR.  Alternative directory names in CDPATH are separated by a colon (:).
    A null directory name is the same as the current directory.  If DIR begins
    with a slash (/), then CDPATH is not used.
    
    If the directory is not found, and the shell option `cdable_vars' is set,
    the word is assumed to be  a variable name.  If that variable has a value,
    its value is used for DIR.
    
    Options:
      -L        force symbolic links to be followed: resolve symbolic
                links in DIR after processing instances of `..'
      -P        use the physical directory structure without following
                symbolic links: resolve symbolic links in DIR before
                processing instances of `..'
      -e        if the -P option is supplied, and the current working
                directory cannot be determined successfully, exit with
                a non-zero status
      -@        on systems that support it, present a file with extended
                attributes as a directory containing the file attributes
    
    The default is to follow symbolic links, as if `-L' were specified.
    `..' is processed by removing the immediately previous pathname component
    back to a slash or the beginning of DIR.
    
    Exit Status:
    Returns 0 if the directory is changed, and if $PWD is set successfully when
    -P is used; non-zero otherwise.
Команда man

man: Показывает справочную информацию для большинства команд и программ в системе, включая утилиты, программы и конфигурационные файлы.


Команда man используется для отображения страниц справочного руководства (man pages) для различных команд и программ. Эти страницы содержат подробную информацию о синтаксисе команд, доступных опциях и примерах использования.

$ man man
Тут будет очень много информации о том как это чудо можно использовать.

$ man ls
Откроется руководство по листу.