manual/source/C/command_line.rst

63 lines
2.3 KiB
ReStructuredText
Raw Normal View History

************************
Appendix C Command line
************************
The command line or cli is text interface to your computer and an alternative to graphical user interfaces like windows. It typically involves typing text commands into a terminal to perform some operation. Although not necessary to learn, it can be helpful. The terminal which can be launched from :kbd:`Ctorol + Alt + T` is a command line running in a window.
An exhaustive tutorial on the command line is a bit beyond the scope of the manual. The man command brings up the user manual and can be used to learn more about a commands use, its options and inputs. If you wanted to learn more about the df (disk free) command, enter the following into a command line:
.. code::
man df
2019-06-03 18:36:23 -07:00
This will show you the user manual for the df command containing and explanation of the command and other useful information. For example is the -h option gives a human readable output. If the manual is way to long you can press the :kbd:`/` key and type in what you want to search for.
.. code::
df -h
will make a much nicer output than
.. code::
df
2018-11-02 22:34:42 -07:00
To list files on the current file system one of the most important commands to know is ls.
2018-11-02 22:34:42 -07:00
.. code::
ls
will show the files in your current directory and the man page lists more options such as viewing all files or long listing.
2019-01-07 08:00:01 -08:00
To change to another directory an important command is
.. code::
cd [dir]
where [dir] is the directory you want to switch to. Another thing that is useful is you can append .. after cd to make it go up one level.
2019-01-07 08:00:01 -08:00
2019-04-24 14:55:08 -07:00
There is also the command line for managing and installing packages which is beyond the scope of this appendix but please see `apt package management <https://help.ubuntu.com/lts/serverguide/apt.html.en>`_ for how to insert and remove packages from the command line.
2019-02-20 10:47:02 -08:00
If you need to edit a text file from the command line the easiest editor included is nano so to edit a file from the command line if you broke something run
.. code::
nano [file]
where you replace [file] with the file you want to edit.
2019-03-24 21:23:46 -07:00
If you want to stop something running in the terminal press :kbd:`Control +C`.
2019-06-03 18:36:23 -07:00
2019-06-10 11:56:20 -07:00
If you want just to see the contents of a file on standard output run
.. code::
cat [filename]