Difference between revisions of "Basic Commands"

From 6bit.ch wiki
Jump to navigation Jump to search
 
(9 intermediate revisions by the same user not shown)
Line 1: Line 1:
=ls=
= cp =
<code>-a, --archive</code> Combines the d, p and r options</br>
<code>-b, --backup</code> before removal, make a backup</br>
<code>-d, --no-deference</code> preserve links</br>
<code>-f, --force</code> remove existing destinations without prompting</br>
<code>-i, --interactive</code> show prompt before overwriting</br>
<code>-l, --link</code> link files instead</br>
<code>-p, --preserve</code> preserve file attributes</br>
<code>-r, --recursive</code> recursively copy directories</br>


-a, --all</br>
= column =
do not ignore entries starting with .
Arrange output in columns</br>
<code>-t</code> create table


-h, --human-readable</br>
= hostname =
with -l and -s, print sizes like 1K 234M 2G etc
Shows the current hostname.</br>
<code>-f</code> show FQDN


-l</br>
<code>hostnamectl status</code> (default) show current system hostname and related information.</br>
use a long listing format
<code>hostnamectl set-hostname</code> set and apply a new hostname</br>


-r, --reverse</br>
= last =
reverse order while sorting
Show a list of last logged in users and system boots.</br>
Can be refined with a username/keyword.</br>


-t</br>
= lastb =
sort by time, newest first
Show a list of last failed login attempts.</br>
Can be refined with a username/keyword.</br>


=tar=
= ls =
List files and folders.</br>
<code>-a</code> do not ignore entries starting with .</br>
<code>-F</code> append a symbol to indicate type (* executable, / directory, @ symlink, = socket, | named pipe, > door)</br>
<code>-h</code> (with <code>-l</code> and <code>-s</code>) print sizes like 1K 234M 5G</br>
<code>-i</code> display inode number</br>
<code>-l</code> use a long listing format</br>
<code>-r</code> reverse order while sorting</br>
<code>-s</code> display size</br>
<code>-t</code> sort by time, newest first</br>


-c</br>
= less & more =
create tarball
<code>space / f</code> scroll forward one screen</br>
<code>enter</code> scroll forward one line</br>
<code>b</code> scroll backward one screen</br>
<code>d</code> scroll forward half a screen</br>
<code>h</code> display help</br>
<code>q</code> quit</br>
<code>/string</code> search string forward</br>
<code>?string</code> search string backward</br>
<code>n</code> find next occurrence</br>
<code>N</code> find previous occurrence (less only)</br>


-f</br>
= setfacl =
specify tarball name
<code>-b</code> remove all access acls</br>
<code>-d</code> apply default acl</br>
<code>-k</code> remove all default acls</br>
<code>-m</code> set or modify acls</br>
<code>-n</code> prevent automatic recalculation of mask</br>
<code>-R</code> apply recursive</br>
<code>-x</code> remove access acl</br>


-p</br>
= sort =
preserve file permissions, default as root
Used to sort output.</br>
<code>-u</code> only display unique names</br>
<code>-n</code> numeric sort</br>
<code>-r</code> reverse order</br>


-r</br>
= w =
append files to the end of an existing uncompressed tarball
Display current system information.</br>


-t</br>
= watch =
list contents of an existing tarball
Execute a command every X seconds (default 2).</br>
<code>watch -n X who</code> execute the who command every X seconds</br>


-u</br>
= wc =
append files to the end of an existing uncompressed tarball, if files are newer
Display lines (<code>-l</code>), words (<code>-w</code>), bytes (<code>-c</code>) or characters (<code>-m</code>) of file.


-v</br>
= whatis =
verbose
Display one-line man page description of a command.</br>


-x</br>
= whereis =
extract tarball
Locate the binary, source and man pages for a command.</br>


-j</br>
= which =
compress using bzip2
Locate a command.</br>


-z</br>
= who =
compress using gzip
Display currently logged in users.</br>

Latest revision as of 11:59, 22 September 2023

cp

-a, --archive Combines the d, p and r options
-b, --backup before removal, make a backup
-d, --no-deference preserve links
-f, --force remove existing destinations without prompting
-i, --interactive show prompt before overwriting
-l, --link link files instead
-p, --preserve preserve file attributes
-r, --recursive recursively copy directories

column

Arrange output in columns
-t create table

hostname

Shows the current hostname.
-f show FQDN

hostnamectl status (default) show current system hostname and related information.
hostnamectl set-hostname set and apply a new hostname

last

Show a list of last logged in users and system boots.
Can be refined with a username/keyword.

lastb

Show a list of last failed login attempts.
Can be refined with a username/keyword.

ls

List files and folders.
-a do not ignore entries starting with .
-F append a symbol to indicate type (* executable, / directory, @ symlink, = socket, | named pipe, > door)
-h (with -l and -s) print sizes like 1K 234M 5G
-i display inode number
-l use a long listing format
-r reverse order while sorting
-s display size
-t sort by time, newest first

less & more

space / f scroll forward one screen
enter scroll forward one line
b scroll backward one screen
d scroll forward half a screen
h display help
q quit
/string search string forward
?string search string backward
n find next occurrence
N find previous occurrence (less only)

setfacl

-b remove all access acls
-d apply default acl
-k remove all default acls
-m set or modify acls
-n prevent automatic recalculation of mask
-R apply recursive
-x remove access acl

sort

Used to sort output.
-u only display unique names
-n numeric sort
-r reverse order

w

Display current system information.

watch

Execute a command every X seconds (default 2).
watch -n X who execute the who command every X seconds

wc

Display lines (-l), words (-w), bytes (-c) or characters (-m) of file.

whatis

Display one-line man page description of a command.

whereis

Locate the binary, source and man pages for a command.

which

Locate a command.

who

Display currently logged in users.