Linux 繧ウ繝槭Φ繝画掠隕玖。ィ/Linux commands cheet-sheet
===============================================

縺薙�繝壹�繧ク縺ァ縺ッ縲√◆縺上&繧薙≠繧記inux縺ョ繧ウ繝槭Φ繝峨�縺�■縲∫音縺ォ蝓コ譛ャ逧�↑謫堺ス�
縺ァ縺ゅk縲√ヵ繧。繧、繝ォ縺ョ荳€隕ァ縲∫ァサ蜍輔€∝炎髯、縺ィ縺�▲縺溘ヵ繧。繧、繝ォ髢「騾」縺ョ繧ウ繝槭Φ繝峨�
菴ソ縺�婿縺ョ萓九r遉コ縺励∪縺吶€ゅ*縺」縺ィ隕区ク。縺帙k繧医≧縺ォ縲∬ェャ譏弱�譛€蟆城剞縺ォ縺ィ縺ゥ繧√∪縺吶€�
Linux謫堺ス懊′縺ッ縺倥a縺ヲ縺ィ縺�≧莠コ縺ッ縲√∪縺壹%繧後i繧偵�繧ケ繧ソ繝シ縺励∪縺励g縺�€�

繧ウ繝槭Φ繝峨Λ繧、繝ウ謫堺ス懊r譛ャ縺ァ縺励▲縺九j蜍牙シキ縺励※縺ソ縺溘>縺ィ縺�≧譁ケ縺ォ縺ッ縲�
[荳牙ョ�2015]_ 繧� [荳ュ蟲カ2018]_ 縺ィ縺�▲縺滓悽繧偵♀蜍ァ繧√@縺セ縺吶€�

In this page, the most basic commands are shown, which are the file
related commands, such as listing, copying, moving, deleting files.
To make it easy to glimpse through, minimal explanation is given.
If you are a beginner to linux, these are the commands you should
learn first.

繝輔ぃ繧、繝ォ縺ォ髢「縺吶k繧ウ繝槭Φ繝�/commands on files
------------------------------------------

.. _command-ls:

ls 繝�ぅ繝ャ繧ッ繝医Μ縺ョ荳ュ霄ォ繧定ヲ九k/list the contents of a directory
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

繧ォ繝ャ繝ウ繝医ョ繧」繝ャ繧ッ繝医Μ縺ョ荳ュ霄ォ繧定ヲ九k:

list the contents of the current working directory::

   % ls
   Desktop  Documents  Downloads  Music  Pictures  Public  Templates  Videos  snap

:term:`髫�縺励ヵ繧。繧、繝ォ` (繝輔ぃ繧、繝ォ蜷阪′"." 縺ァ蟋九∪繧九ヵ繧。繧、繝ォ)繧ょ性繧√※蜈ィ縺ヲ縺ョ繝輔ぃ繧、繝ォ繧定ヲ九k:

list ALL files, including :term:`hidden files` (files with names starting with a period)::

   % ls -a
   .          .bash_history  .dbus   .profile   Documents  Pictures   Videos
   ..         .bashrc        .gnupg  .synaptic  Downloads  Public     snap
   .aptitude  .cache         .local  Desktop    Music      Templates


繝悶Ο繝�け謨ー縺ァ謨ー縺医◆繝輔ぃ繧、繝ォ縺ョ髟キ縺輔r陦ィ遉コ縺ォ蜷ォ繧√k:

Include the file length counted in terms of disk blocks::

  % ls -s
  蜷郁ィ� 36
  4 Desktop    4 Downloads  4 Pictures  4 Templates  4 snap
  4 Documents  4 Music      4 Public    4 Videos

繝舌う繝域焚縺ァ謨ー縺医◆繝輔ぃ繧、繝ォ縺ョ髟キ縺輔d縲∵戟縺。荳サ縺ェ縺ゥ縺ョ隧ウ邏ー縺ェ諠��ア繧貞性繧€髟キ蠖「蠑上〒陦ィ遉コ縺吶k:

List in LONG form, including the file length in bytes, and owner names::

  % ls -l
  蜷郁ィ� 36
  drwxr-xr-x 2 root root 4096 12譛� 30  2017 Desktop
  drwxr-xr-x 2 root root 4096 12譛� 30  2017 Documents
  drwxr-xr-x 2 root root 4096 12譛� 30  2017 Downloads
  drwxr-xr-x 2 root root 4096 12譛� 30  2017 Music
  drwxr-xr-x 2 root root 4096 12譛� 30  2017 Pictures
  drwxr-xr-x 2 root root 4096 12譛� 30  2017 Public
  drwxr-xr-x 2 root root 4096 12譛� 30  2017 Templates
  drwxr-xr-x 2 root root 4096 12譛� 30  2017 Videos
  drwxr-xr-x 7 root root 4096 12譛� 31  2017 snap

譎ョ騾壹�繝輔ぃ繧、繝ォ縺ェ縺ョ縺九ョ繧」繝ャ繧ッ繝医Μ縺ェ縺ョ縺九r蛹コ蛻・縺吶k險伜捷繧偵▽縺代※陦ィ遉コ縺吶k:

Append a character to the file name representing the file type such as a directory::

  % ls -F
  Desktop/    Downloads/  Pictures/  Templates/  snap/
  Documents/  Music/      Public/    Videos/

濶イ繧偵▽縺代※陦ィ遉コ縺吶k:

Use colors::

  % ls --color=auto

隍�焚縺ョ繧ェ繝励す繝ァ繝ウ繧堤オ�∩蜷医o縺帙※陦ィ遉コ縺吶k:

Combine multiple options at once::

  % ls --color=auto -Fs

縺ゥ繧薙↑繧ェ繝励す繝ァ繝ウ縺後≠繧九�縺玖ェソ縺ケ繧�:

Check what options are available::

  % ls --help
  % man ls

.. _command-pwd:

pwd 迴セ蝨ィ縺ョ繝�ぅ繝ャ繧ッ繝医Μ繧堤「コ隱阪☆繧�/print the current working directory
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

繧キ繧ァ繝ォ縺ョ迴セ蝨ィ縺ョ菴懈・ュ繝�ぅ繝ャ繧ッ繝医Μ繧定。ィ遉コ縺吶k:

Print the shell's current working directory::

  % pwd
  /home/takahashi

pwd = print working directory

.. _command-cd:

cd 繝�ぅ繝ャ繧ッ繝医Μ縺ョ遘サ蜍�/change the working directory
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
繧オ繝悶ョ繧」繝ャ繧ッ繝医Μ縺ォ遘サ蜍輔☆繧�:

go to a subdirectory::

  % cd subdirectory_name

隕ェ繝�ぅ繝ャ繧ッ繝医Μ縺ォ遘サ蜍輔☆繧�:

go to the parent directory::

  % cd ..

繝帙�繝�繝�ぅ繝ャ繧ッ繝医Μ縺ォ遘サ蜍輔☆繧�:

Go to your home directory::

  % cd

縺ゥ縺薙°螂・縺セ縺」縺溘ョ繧」繝ャ繧ッ繝医Μ縺ァ菴懈・ュ縺励※縺�k縺ィ縺阪↓縲�俣驕輔∴縺ヲcd縺ォ繝�ぅ繝ャ繧ッ繝医Μ蜷阪r
謖�ョ壹@縺昴�繧後k縺ィ縲√%縺ョ蠖「蠑上↓縺ェ縺」縺ヲ縺励∪縺」縺ヲ繝帙�繝�繝�ぅ繝ャ繧ッ繝医Μ縺ォ遘サ蜍輔@縺ヲ縺励∪縺�
縺ョ縺ァ縲∵ウィ諢上@縺セ縺励g縺�€�

When you are working in some deep place in the directory tree, and use cd by
mistake without an argument, this form will take effect and you will be taken
right back to your home directory, so be careful.

逶ク蟇セ繝代せ蜷阪〒蛻・縺ョ繝�ぅ繝ャ繧ッ繝医Μ縺ォ遘サ蜍輔☆繧�:

go to another directory using a relative path name::

  % cd docs/chapter1/section2

邨カ蟇セ繝代せ蜷阪〒蛻・縺ョ繝�ぅ繝ャ繧ッ繝医Μ縺ォ遘サ蜍輔☆繧�:

go to another directory using an absolute path name::

  % cd /usr/share

.. _command-mkdir:

mkdir 繝�ぅ繝ャ繧ッ繝医Μ縺ョ菴懈�/creating directories
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

繝�ぅ繝ャ繧ッ繝医Μ繧剃ク€縺、菴懈�縺吶k:

make one directory::

  % mkdir my_project

繝�ぅ繝ャ繧ッ繝医Μ繧定、�焚菴懈�縺吶k:

make a couple of directories at once::

  % mkdir include src

譛ォ遶ッ縺ョ繝�ぅ繝ャ繧ッ繝医Μ縺ォ蜉�縺医※縲∝ュ伜惠縺励※縺�↑縺�ヲェ繝�ぅ繝ャ繧ッ繝医Μ繧ゆス懈�縺吶k:

make not just the target directory but also any not-yet-created PARENT directories as well::

  % mkdir -p my_project/src

.. _command-cp:

cp 繝輔ぃ繧、繝ォ縺ョ繧ウ繝斐�/copying files
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

繧ウ繝斐�蜈�€√さ繝斐�蜈医€√◎繧後◇繧後�繝輔ぃ繧、繝ォ蜷阪r謖�ョ壹@縺ヲ繧ウ繝斐�縺吶k��git縺ョ邂。逅�ク九�繝輔ぃ繧、繝ォ縺ョ蜑企勁縺ッgit縺ョ繧ウ繝槭Φ繝峨↓萓昴k�� :

Copy one file specifying the source file name and the destination file name (Use git commands for files managed by git)::

  % cp source_file_name destination_file_name

繧ウ繝斐�蜈医ョ繧」繝ャ繧ッ繝医Μ蜷阪r謖�ョ壹@縺ヲ繧ウ繝斐�縺吶k:

Copy one or more files specifying the source file names and one destination directory name::

  % cp file_name1 file_name2 ...  directory_name

繝�ぅ繝ャ繧ッ繝医Μ縺ョ荳ュ霄ォ縺セ縺ァ縲∝�蟶ー逧�↓繧ウ繝斐�縺吶k:

Copy directory contents RECURSIVELY::

  % cp -r source_directory_name destination_directory_name

繝ッ繧、繝ォ繝峨き繝シ繝�/wildcards
^^^^^^^^^^^^^^^^^^^^^^^^^

諡。蠑オ蟄� .h 縺ァ邨ゅo繧九ヵ繧。繧、繝ォ蜈ィ縺ヲ繧� include 繧オ繝悶ョ繧」繝ャ繧ッ繝医Μ縺ォ繧ウ繝斐�縺吶k:

Copy all files that ends with ".h" into subdirectory "include"::

  % cp *.h include

繝ッ繧、繝ォ繝峨き繝シ繝峨�繧キ繧ァ繝ォ縺ョ讖溯�縺ェ縺ョ縺ァ縲√←縺ョ繧ウ繝槭Φ繝峨〒繧ゆス懃畑縺吶k縲�

The wildcard expansion function is provided by the shell, so it applies to any command.

.. _command-mv:

mv 繝輔ぃ繧、繝ォ縺ョ蜷咲ァー螟画峩繧�ァサ蜍�/renaming and moving files
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

繝輔ぃ繧、繝ォ蜷阪□縺代r螟画峩縺吶k縲√≠繧九>縺ッ譬シ邏榊�繝�ぅ繝ャ繧ッ繝医Μ繧貞、画峩縺吶k縲√≠繧九>縺ッ荳。閠�r荳€蠎ヲ縺ォ螟画峩縺吶k��git縺ョ邂。逅�ク九�繝輔ぃ繧、繝ォ縺ョ蜑企勁縺ッgit縺ョ繧ウ繝槭Φ繝峨↓萓昴k��:

Change the file name, or change the directory where the file belongs, or change both at once.(Use git commands for files managed by git)::

  % mv old_file_name new_file_name
  % mv old_directory/file_name new_directory/file_name
  % mv old_directory/old_file_name new_directory/new_file_name

隍�焚縺ョ繝輔ぃ繧、繝ォ繧貞挨縺ョ繝�ぅ繝ャ繧ッ繝医Μ縺ォ遘サ蜍輔&縺帙k:

Move multiple files into one directory::

  % mv file_name1 file_name2 ... directory_name

.. _command-rm:

rm 繝輔ぃ繧、繝ォ縺ョ蜑企勁/deleting (removing) files
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

繝輔ぃ繧、繝ォ繧貞炎髯、縺吶k��git縺ョ邂。逅�ク九�繝輔ぃ繧、繝ォ縺ョ蜑企勁縺ッgit縺ョ繧ウ繝槭Φ繝峨↓萓昴k��:

Remove files(Use git commands for files managed by git)::

  % rm file_name1 file_name2 ...

繝�く繧ケ繝医ヵ繧。繧、繝ォ縺ョ菴懈�繧�キィ髮�/creating and editing text files
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

繝�く繧ケ繝医ヵ繧。繧、繝ォ縺ョ菴懈�縺ォ縺ッ繝�く繧ケ繝医お繝�ぅ繧ソ繧剃スソ縺�∪縺吶€�
縲後ユ繧ュ繧ケ繝医お繝�ぅ繧ソ縲阪→縺�≧縺ョ縺ッ縲√Ρ繝シ繝励Ο繧ス繝輔ヨ縺ョ繧医≧縺ォ縲√ユ繧ュ繧ケ繝�
繝輔ぃ繧、繝ォ繧堤キィ髮�☆繧九◆繧√�繝励Ο繧ー繝ゥ繝�縺ァ縺吶€ゅΡ繝シ繝励Ο繧ス繝輔ヨ縺ィ逡ー縺ェ繧翫€�
譁�ュ励ョ繝シ繧ソ縺昴�繧ゅ�繧堤キィ髮�☆繧玖�蜉帙@縺区戟縺溘★縲√ヵ繧ゥ繝ウ繝医r邏ー縺九¥
螟峨∴縺溘j縺吶k縺薙→縺ッ縺ァ縺阪∪縺帙s縲�

To create a text file, you use a text editor program.
A "text editor" is a program for typing text files, just like a
word processor.  Unlike a word processor program, you can enter
and edit text data only, and there is no such thing as
changing the font or color.

繧ィ繝�ぅ繧ソ縺ォ縺ッ縺�m縺�m縺ェ繧ゅ�縺後≠繧翫∪縺吶€� :ref:`text-editor` 繧貞盾辣ァ縲�

There are many available text editors. See :ref:`text-editor`.

nano繧ィ繝�ぅ繧ソ縺ァ繝輔ぃ繧、繝ォ蜷阪r謖�ョ壹@縺ヲ繝�く繧ケ繝医お繝�ぅ繧ソ繧定オキ蜍輔☆繧�:

Invoke the 'nano' text editor giving the file name::

  % nano hello.c

less 繝�く繧ケ繝医ヵ繧。繧、繝ォ縺ョ荳ュ霄ォ縺ョ遒コ隱�/checking the content of text files
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
繝�く繧ケ繝医ヵ繧。繧、繝ォ繧定。ィ遉コ縺輔○縲√く繝シ謫堺ス懊〒蜑榊セ後↓繧ケ繧ッ繝ュ繝シ繝ォ縺輔○繧�:

Show the content of a text file and provide keys to scroll::

  % less hello.c

荳サ縺ェ繧ュ繝シ謫堺ス�:

* ``q`` 邨ゆコ�
* ``SPACE`` 1繝壹�繧ク騾イ繧√k
* ``b`` 1繝壹�繧ク謌サ縺�
* ``g`` 蜈磯�ュ縺ォ謌サ繧�
* ``G`` 譛ォ蟆セ縺ォ騾イ繧€
* ``/譁�ュ怜�[ENTER]`` 譛ォ蟆セ縺ォ蜷代¢縺ヲ譁�ュ怜�繧呈、懃エ「縺吶k
* ``?譁�ュ怜�[ENTER]`` 蜈磯�ュ縺ォ蜷代¢縺ヲ譁�ュ怜�繧呈、懃エ「縺吶k

Commonly used functions:

* ``q`` quit
* ``SPACE`` move one page forward(towards the end of file)
* ``b`` move one page backward
* ``g`` go to the top of the file
* ``G`` go to the end of the file
* ``/pattern[ENTER]`` search a pattern towards the end of the file
* ``?pattern[ENTER]`` search a pattern towards the beginning of the file


繧キ繧ァ繝ォ縺ョ螟画焚/shell variables
----------------------------
繧キ繧ァ繝ォ螟画焚繝サ迺ー蠅�、画焚/shell variables and environment variables
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

:term:`繧キ繧ァ繝ォ螟画焚` 縺ォ蛟、繧定ィュ螳壹☆繧九↓縺ッ縲√€悟、画焚蜷�=蛟、縲阪→譖ク縺阪∪縺吶€�
螟画焚蜷阪→"="縺ョ髢薙↓遨コ逋ス繧偵>繧後※縺ッ縺�¢縺セ縺帙s:

To assign a value to a shell variable, use the form "NAME=VALUE".
Do not put a space before "="::

  SOMEVAR=123
  OPTIONS="-Fs"
  MORE_OPTIONS="$OPTIONS --color=auto"

繧キ繧ァ繝ォ螟画焚縺ョ蜿ら�縺ォ縺ッ縲√€�$螟画焚蜷阪€阪→譖ク縺阪∪縺�:

To get the value of a shell variable, use the form "$VAR_NAME"::

  DESTDIR=../../some/distant/directory
  cp my_source_file.c $DESTDIR

"export 繧キ繧ァ繝ォ螟画焚蜷�" 縺ィ縺�≧繧ウ繝槭Φ繝峨↓繧医j縲∝€、繧定ィュ螳壽ク医∩縺ョshell螟画焚繧偵€�
:term:`迺ー蠅�、画焚` 縺ォ螟画鋤縺吶k縺薙→縺後〒縺阪∪縺�:

With the command "export variable-name", an existing shell variable can be
converted to an :term:`environment variable`::

  export SOMEVAR

螟画焚縺ョ蜀�ョケ繧定。ィ遉コ縺吶k/showing variable values
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

echo繧ウ繝槭Φ繝峨↓貂。縺吝シ墓焚繧偵◎縺ョ縺セ縺セ繧ェ繧ヲ繝�霑斐@縺ォ陦ィ遉コ縺吶k(echo back縺吶k):

The echo command will "echo back" the arguments::

  % SOMEVAR="one two three"
  % echo $SOMEVAR
  one two three
  % echo The value of SOMEVAR is $SOMEVAR
  The value of SOMEVAR is one two three

echo繧ウ繝槭Φ繝峨↓蠑墓焚縺梧ク。縺輔l繧区焔蜑阪〒縲《hell縺�$SOMEVAR縺ョ蛟、繧貞ア暮幕縺励€�
echo繧ウ繝槭Φ繝峨�貂。縺輔l縺溷シ墓焚繧偵◎縺ョ縺セ縺セ陦ィ遉コ縺吶k縺ョ縺ァ縲∽クュ霄ォ繧堤「コ隱阪〒縺阪∪縺吶€�

The shell will replace "$SOMEVAR" with the content of SOMEVAR,
and the echo command will receive the replaced result as arguments so
the content of the variables will be shown.
In this way, echo can be used to check the value of shell variables.

蠑墓焚縺ォ縺、縺代k蠑慕畑隨ヲ/quotes on command arguments
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

遨コ逋ス繧貞性繧€蠑墓焚繧偵さ繝槭Φ繝峨↓貂。縺吶↓縺ッ縲√ム繝悶Ν繧ッ繧ゥ繝シ繝医r菴ソ縺�∪縺�:

Use double quotes to pass arguments that include spaces::

  % echo These words will be separate commandline arguments.
  % echo "But these words will be a single commandline argument."

繝€繝悶Ν繧ッ繧ゥ繝シ繝医�荳ュ縺ァ繧ゅ€∝、画焚縺ョ螻暮幕縺ッ陦後o繧後∪縺�:

Variables references is active inside double quotes::

  % SOMEVAR=one two three
  % echo "The value of SOMEVAR is now : $SOMEVAR"
  The value of SOMEVAR is now : one two three

螟画焚縺ョ螻暮幕繧よ椛豁「縺励◆縺��エ蜷茨シ医€�$縲阪→陦ィ遉コ縺励◆縺��エ蜷医↑縺ゥ�峨�縲�
繧キ繝ウ繧ー繝ォ繧ッ繧ゥ繝シ繝医r菴ソ縺�∪縺�:

When you want to inhibit variable references,
(e.g. when you want to print the "$" character), use single quotes.::

  % echo 'Use the notation $VARNAME to get the value of VARNAME.'
  Use the notation $VARNAME to get the value of VARNAME.

蠑慕畑隨ヲ縺ョ荳ュ縺ァ蠑慕畑隨ヲ繧呈嶌縺阪◆縺��エ蜷医↓縺ッ縲√◎縺ョ譁�ュ励�蜑阪↓繧ィ繧ケ繧ア繝シ繝玲枚蟄励�
繝舌ャ繧ッ繧ケ繝ゥ繝�す繝・縺セ縺溘�蜀��繝シ繧ッ�域枚蟄励さ繝シ繝峨�蜷後§繧ゅ�縺�縺後€∫ォッ譛ォ繧�
繝輔か繝ウ繝医�險ュ螳壹↓繧医▲縺ヲ陦ィ遉コ縺悟、峨o繧具シ峨r縺、縺代∪縺吶€�::

  echo 'Inside single quotes, \'$VARNAME\' will not be expanded.'

迺ー蠅�、画焚縺ョ險ュ螳�/Setting environment variables
--------------------------------------------

迺ー蠅�、画焚PATH繧剃ク€譎ら噪縺ォ險ュ螳壹☆繧�/temporarily set the environment variable PATH
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

縺吶〒縺ォ螳夂セゥ縺輔l縺ヲ縺�kPATH縺ョ蛟、縺ォ蜉�縺医※縲√�繝シ繝�繝�ぅ繝ャ繧ッ繝医Μ縲�$HOME縲阪�荳九�bin繝�ぅ繝ャ繧ッ繝医Μ
繧定ソス蜉�縺吶k萓�:

Append the "bin" directory inside your home directory to the environment variable PATH::

  % export PATH=$PATH:$HOME/bin

- export 縺ッ縲∝、画焚縺檎腸蠅�、画焚縺ァ縺ゅk縺薙→繧貞ョ」險€縺吶k繧ュ繝シ繝ッ繝シ繝�
- 莉」蜈・縺ョ蜿ウ霎コ縺ョ$PATH縺ッ縲√b縺ィ縺ョPATH縺ョ蛟、縺ォ螻暮幕縺輔l繧�
- $HOME 縺ッ繝帙�繝�繝�ぅ繝ャ繧ッ繝医Μ縺ョ繝代せ蜷阪↓螻暮幕縺輔l繧�

繧キ繧ァ繝ォ縺ォ逶エ謗・export縺ィ蜈・蜉帙☆繧九%縺ョ譁ケ豕輔〒縺ッ縲√ち繝シ繝溘リ繝ォ繧定ソス蜉�縺ァ髢九>縺溘j縲�
谺。蝗槭Ο繧ー繧、繝ウ縺励◆髫帙↓縺ッ險ュ螳壹′螟ア繧上l繧九�縺ァ縲∽ク€譎ら噪縺ェ險ュ螳壹〒讒九o縺ェ縺�→縺阪↓菴ソ縺�∪縺吶€�

The above method of typing in "export" to a shell will have the effect
only in that shell, and when you open a new terminal or login again,
the setting will be lost.  So use this style when a temporary setting
is enough.

迺ー蠅�、画焚PATH繧偵€∝クク縺ォ譛牙柑縺ォ縺ェ繧九h縺�↓險ュ螳壹☆繧�/permanently set the environment variable PATH
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

迺ー蠅�、画焚縺ク縺ョ險ュ螳壹r繧キ繧ァ繝ォ縺ョ蛻晄悄蛹悶ヵ繧。繧、繝ォ縺ォ譖ク縺�※縺翫¥縺ィ縲√Ο繧ー繧、繝ウ譎ゅ↓
豈主屓險ュ螳壹&繧後k繧医≧縺ォ縺ェ繧翫∪縺吶€�

繝帙�繝�繝�ぅ繝ャ繧ッ繝医Μ逶エ荳九� .profile繝輔ぃ繧、繝ォ縺ォ繝�く繧ケ繝医お繝�ぅ繧ソ縺ァPATH縺ク縺ョ莉」蜈・繧呈嶌縺榊刈縺医∪縺吶€�

Open or create the .profile file in your home directory with a text editor
and add an assignment to PATH. ::

    # This file is .profile
    export PATH=$PATH:$HOME/bin

螟画峩縺梧怏蜉ケ縺ォ縺ェ繧九�縺ッ縲√%縺ョ繝輔ぃ繧、繝ォ縺後す繧ァ繝ォ縺ォ隱ュ縺ソ霎シ縺セ繧後k繧ソ繧、繝溘Φ繧ー縺ァ縺吶€�
macos縺ョ蝣エ蜷医�縲√ち繝シ繝溘リ繝ォ繧ヲ繧」繝ウ繝峨え繧帝哩縺倥※髢九″逶エ縺帙�縲√◎縺ョ譎らせ縺ァ隱ュ縺ソ霎シ縺セ繧後∪縺吶€�
Linux縺ョ蝣エ蜷医�縲√Ο繧ー繧、繝ウ縺励↑縺翫@縺滓凾轤ケ縺ァ譛牙柑縺ォ縺ェ繧翫∪縺吶€�

The change will take effect when the shell reads it.  For macos, when you
close the terminal window and reopen it, the file will be read.
For linux, the file will be read on the next login.

:ref:`shell-rc-files` 縺ォ縲√&繧峨↓隧ウ縺励>隱ャ譏弱′縺ゅj縺セ縺吶€�

See also  :ref:`shell-rc-files`.

.. _command-history:

history 繧ウ繝槭Φ繝牙ア・豁エ/command history
------------------------------------

繧ウ繝槭Φ繝峨�螻・豁エ繧定。ィ遉コ縺吶k:

show the command history::

  % history

逡ェ蜿キ繧呈欠螳壹@縺ヲ螻・豁エ縺ョ荳ュ縺ョ繧ウ繝槭Φ繝峨r蜀榊コヲ螳溯。後☆繧�:

run a command in the history specifying the history number::

  % !73

蜈・蜉帙@縺溘さ繝槭Φ繝峨�蜈磯�ュ縺ョ謨ー譁�ュ励r蜈・蜉帙@縺ヲ縲√さ繝槭Φ繝峨r蜀榊ョ溯。後☆繧�:

run a command in the history specifying the first few letters of the command line::

  % !ma

縺薙�萓九〒縺ッ縲√€稽a縲阪〒蟋九∪繧九€√b縺」縺ィ繧よ怙霑大�蜉帙@縺溘さ繝槭Φ繝�("make"縺ェ縺ゥ)縺悟�蠎ヲ螳溯。後&繧後k縲�

In this case, the most recent command that starts with "ma" will be run (e.g. "make").

繧ク繝ァ繝也ョ。逅�シ医ヰ繝�け繧ー繝ゥ繧ヲ繝ウ繝牙ョ溯。鯉シ�/Job control(background execution)
--------------------------------------------------------------------
繧ク繝ァ繝也ョ。逅��讎ょソオ縺ォ縺、縺�※縺ッ :ref:`shell-job-control` 蜿ら�縲�
�医せ繝代さ繝ウ縺ァ縺ョ繝励Ο繧ー繝ゥ繝�螳溯。後�莉慕オ�∩縺ォ繧ゅ€後ず繝ァ繝悶€阪→縺�≧險€闡峨′蜃コ縺ヲ縺阪∪縺吶′縲∝挨縺ョ繧ゅ�縺ァ縺吶€ゑシ�

See :ref:`shell-job-control` for a description on job control.

繝舌ャ繧ッ繧ー繝ゥ繧ヲ繝ウ繝峨ず繝ァ繝悶→縺励※繧ウ繝槭Φ繝峨r襍キ蜍輔☆繧�:

Invoke a command as a background job::

  % firefox &

螳溯。御クュ縺ョ繝輔か繧「繧ー繝ゥ繧ヲ繝ウ繝峨ず繝ァ繝悶r繧オ繧ケ繝壹Φ繝峨☆繧�:

Suspend the current foreground job::

  Ctrl-z

繧オ繧ケ繝壹Φ繝我クュ縲√♀繧医�繝舌ャ繧ッ繧ー繝ゥ繧ヲ繝ウ繝我クュ縺ョ繧ク繝ァ繝悶�荳€隕ァ繧定。ィ遉コ縺吶k:

Show all jobs that are suspended or running in the background::

  % jobs

繧オ繧ケ繝壹Φ繝峨@縺溘ず繝ァ繝悶r蜀阪�繝輔か繧「繧ー繝ゥ繧ヲ繝ウ繝峨ず繝ァ繝悶→縺励※蜃ヲ逅��髢九&縺帙k:

Resume the suspended job as a foreground job::

  % fg

繧オ繧ケ繝壹Φ繝峨@縺溘ず繝ァ繝悶r繝舌ャ繧ッ繧ー繝ゥ繧ヲ繝ウ繝峨ず繝ァ繝悶→縺励※蜃ヲ逅��髢九&縺帙k:

Resume the suspended job as a background job::

  % bg