Basic (but) Useful Linux Commands

Basic (but) Useful Linux Commands

Revision for “Basic (but) Useful Linux Commands” created on May 5, 2023 @ 14:22:47

Title
Basic (but) Useful Linux Commands
Content
<h1>Command Line Basics - Useful Linux Commands</h1> While it is possible to use Bodhi Linux without much knowledge or use of the Command Line Interface (CLI [terminal]) and to stick primarily with the Graphical User Interface (GUI), there are certain tasks that are more efficient/easier to perform via the CLI/terminal. Generally, you will use a terminal emulator (Bodhi Linux's default is <a href="https://www.bodhilinux.com/w/wiki/terminology/">Terminology</a>) to access the CLI/terminal from the GUI.  As you become more proficient with using Bodhi Linux, you may find yourself gravitating toward the CLI/terminal for certain tasks. Below is a list of some useful commands to get you started! <p style="padding-left: 30px;"><em><strong>***CAUTION***</strong> - if you ever enter a command and are asked to authorize via the question, "Yes, do as I say!"<strong>, <span style="text-decoration: underline;">do not run the command</span></strong>. The operation you are attempting is about to purge system critical packages and will generally result in a non-usable system. You have been warned!***</em></p> <h2>Basic Commands</h2> <code>sudo</code> – <em>superuser do</em> - allows a user to run commands/programs with the privileges of another user, by default root or admin - use when programs request "elevated privileges" <p style="padding-left: 30px;"><em>Note: In Bodhi Linux, the sudo password is your login password by default. </em></p> <code>apt</code> - <em>Advanced Package Tool</em> - used to get and install packages/programs - replaces <em>apt-get</em> <code>update</code> - lets package manager know about available packages/programs and their versions; does not install anything. <code>upgrade</code> - will upgrade versions for packages/programs from the update but will not remove anything nor update dependencies not already installed. <code>dist-upgrade</code> - will upgrade versions for packages/programs and will intelligently install/remove packages as necessary to complete the upgrade. <p style="padding-left: 30px;"><em>For more details see: <a href="https://www.bodhilinux.com/w/keeping-bodhi-linux-up-to-date/">Keeping Bodhi Software Updated</a></em></p> Examples: <pre>sudo apt update &amp;&amp; sudo apt dist-upgrade sudo apt install cups </pre> <h2>Useful Terminal Hotkey Combinations</h2> &lt;ctrl&gt;+&lt;shift&gt;+&lt;c&gt; copy &lt;ctrl&gt;+&lt;shift&gt;+&lt;v&gt; paste &lt;ctrl&gt;+&lt;r&gt; searches command line history &lt;ctrl&gt;+&lt;l&gt; clears the terminal (lower case 'L') &lt;ctrl&gt;+&lt;u&gt; erases entire line to the left of cursor &lt;ctrl&gt;+&lt;k&gt; erases to the right &lt;ctrl&gt;+&lt;w&gt; erases one word left &lt;ctrl&gt;+&lt;d&gt; logout or exit <h2>Commands that are Generally Useful to Know</h2> <code>cat</code> - concatenate, read or modify a file; used to display the contents of a file <code>cd</code> - change directory; used to change your working directory <code>chmod</code> - change permissions; used to change the permissions of a file/directory. <p style="padding-left: 30px;"><em>Note: you must own the file or be <code>sudo</code> for this command</em></p> <code>cp</code> - copy; used to copy files/directories <code>df</code> - shows the amount of disk space used and available on mounted file systems <code>du</code> - shows the amount of disk space used by specified files/directories <code>exit</code> - exits the terminal <code>find</code> - searches directory for files that meet criteria (--name, searches by name; --type, by file type; --size, by file size) <code>grep</code> - searches file for specific character strings/patterns and can be used to replace a string with another string <code>ifconfig</code> - view network settings <code>less</code> - used to view a file vs. opening a file - compared to the <code>more</code> command, <code>less</code> allows backward and forward movement w/in the file, line by line or by page (can be useful to <em>pipe </em>commands to <code>less</code> [the pipe symbol is the straight-line about your enter key; <code>|</code> ]). <code>ln</code> - used to create a hard or symbolic link to a file <code>ls</code> - lists files or directories <code>man</code> - manual; displays built-in documentation/user manual within Bodhi/Linux - commands, how to, syntax, etc <code>mkdir</code> - make directory; used to make an empty directory <code>more</code> - used to view a file vs. opening a file - page by page scrolling <code>mv</code> - move; used to move a file/directory <code>netstat</code> - network statistics; displays info/statistics about network protocols in use and TCP/IP connections <code>passwd</code> - password; used to change a user's own password (admin may change anyone's password) <code>ping</code> - used to test a connection to a host/IP address <code>pwd</code> - print working directory; displays your current working directory <code>rm</code> - remove; used to remove/delete files <code>rmdir</code> - remove directory; used to remove <em>empty </em>directories <code>shutdown</code> - used to shutdown/halt/restart system (ex: <code>sudo shutdown - r now</code> will restart your system) <code>top</code> - task manager program used to monitor system tasks/processes and system resource usage (CPU utilization, memory usage, run times) in real-time, with sorting possible <code>touch</code> - used to create a blank file <code>uname</code> - reports basic information about your environment (ex: <code>uname -a</code> will report kernel name, node name, kernel release, kernel version, machine, processor, hardware platform, and OS) <code>whoami</code> - prints user/login name associated with the current user ID <h2></h2> <h2>Commands Options</h2> <code>-a</code>, <code>--all</code> - all; shows all information (including hidden) or operates on all arguments <code>*</code> - asterisk/splat; wildcard <code>!</code> - exclamation/bang; in scripts, means "not" <code>!!</code>- repeats last command in terminal <code>-f</code> - force; force copy by removing destination file if needed <p style="padding-left: 30px;"><em><strong>CAUTION: </strong>can authorize potentially destructive actions for which a command/program would generally request user confirmation before completing</em></p> <code>-h</code>, <code>--help</code> - help; provides usage messages and assistance <code>-i</code> - interactive; prompts before overwrites, etc <code>-l</code>, <code>--list</code> - list; lists files or arguments <code>|</code>, - pipe; sends the output of one command/program to another command/program for further processing <p style="padding-left: 30px;"><em>Note: the pipe symbol is not an "L" - it is available via</em> &lt;shift&gt;+&lt;\&gt;<em> (backslash) key on most QWERTY keyboards</em></p> <code>-r</code>, <code>-R</code>, <code>--recursive</code> - recursive/reverse; operates a command recursively/down the directory tree <code>-u</code>, <code>--update</code>; move when the source is newer than the destination <code>-v</code>, <code>--verbose</code> - verbose; output additional information <code>-y</code>, <code>--yes</code>; enters yes into a command string - <p style="padding-left: 30px;"><em><strong>CAUTION: </strong>can authorize potentially destructive actions for which a command/program would generally request user confirmation before completing</em></p> <h2></h2> <h2>Commands for Directory Navigation</h2> <code>/</code> - root directory <code>/home</code> - home directory for the current user <code>cd</code> - change directory (when used without providing a directory, will take you to your home directory) <code>cd  ~</code>- takes you to your home directory <code>cd ..</code> - move up one level (the parent directory of current) <code>cd ../../</code> - move up two levels <code>cd -</code>- will take you to where you were previously <p style="padding-left: 30px;"><em>Tip: Have a difficult time remembering commands? Press the up arrow key in <a href="https://www.bodhilinux.com/w/terminology/">Terminology</a> to display commands you have previous run from your terminal history – press up until you find your needed command/s then press enter!</em></p> <a href="https://www.bodhilinux.com/">Bodhi Linux Home</a> <a href="https://www.bodhilinux.com/w/wiki/">Bodhi Linux – Wiki Home Page</a> <a href="https://www.bodhilinux.com/w/bodhi-linux-how-to/">Bodhi Linux – Wiki Table of Contents</a>
Excerpt


OldNewDate CreatedAuthorActions
May 5, 2023 @ 14:22:47 oblio
May 5, 2023 @ 14:22:31 [Autosave] oblio
May 1, 2023 @ 18:03:56 oblio
April 1, 2022 @ 17:23:19 oblio
January 27, 2022 @ 03:26:19 oblio
January 27, 2022 @ 03:03:50 oblio
January 26, 2022 @ 23:15:16 oblio
January 26, 2022 @ 23:14:10 oblio
January 26, 2022 @ 23:12:30 oblio
January 26, 2022 @ 23:09:37 oblio
January 26, 2022 @ 23:06:02 oblio
January 26, 2022 @ 22:55:41 oblio
January 26, 2022 @ 22:41:58 oblio
January 26, 2022 @ 22:31:33 oblio
January 26, 2022 @ 22:26:20 oblio
January 26, 2022 @ 16:36:13 oblio
November 26, 2021 @ 16:13:27 oblio
November 24, 2021 @ 19:25:14 oblio
November 18, 2021 @ 05:08:14 oblio
November 18, 2021 @ 05:06:48 oblio
November 18, 2021 @ 05:03:44 oblio
November 18, 2021 @ 04:12:01 oblio
November 18, 2021 @ 03:14:02 oblio
August 21, 2021 @ 11:50:30 oblio
July 12, 2021 @ 19:42:19 oblio
July 12, 2021 @ 18:40:29 oblio
July 12, 2021 @ 18:06:14 oblio
July 12, 2021 @ 17:26:10 oblio
July 12, 2021 @ 17:25:47 oblio
July 12, 2021 @ 17:25:08 oblio
July 12, 2021 @ 17:05:17 oblio
November 6, 2020 @ 12:47:58 FidoeDidoe
November 6, 2020 @ 12:47:07 [Autosave] FidoeDidoe
November 3, 2020 @ 10:58:53 FidoeDidoe
November 2, 2020 @ 10:32:48 FidoeDidoe
February 2, 2018 @ 16:11:53 FidoeDidoe
February 2, 2018 @ 16:11:44 [Autosave] FidoeDidoe
January 4, 2018 @ 03:03:14 FidoeDidoe
January 4, 2018 @ 03:02:47 FidoeDidoe
January 4, 2018 @ 03:01:44 FidoeDidoe
January 4, 2018 @ 03:00:34 FidoeDidoe
January 4, 2018 @ 02:53:26 FidoeDidoe
January 2, 2018 @ 17:23:07 FidoeDidoe
January 2, 2018 @ 17:13:24 FidoeDidoe
January 2, 2018 @ 05:35:44 FidoeDidoe
January 2, 2018 @ 04:46:00 FidoeDidoe