En gros, c'est ce qui va interpréter les commandes lancées dans une
fenêtre. En tapant 'ps' dans une fenêtre, on peut voir les shells
utilisés.
cajal-%28%% ps
PID TTY S TIME CMD
14364 ttyp1 I + 0:00.12 -ksh (ksh)
29344 ttyp2 S + 0:00.06 -csh (tcsh)
...
Ici, la fenêtre ttyp1 utilise ksh tandis que la fenêtre
ttyp2 utilise tcsh.
Votre shell par défaut est spécifié dans le fichier
(/etc/)passwd où votre login est déclaré.
Il existe un grand nombre de shells : sh, csh, tcsh, ksh, bash, ... pour avoir une aide en ligne de votre shell, utiliser 'man'. Exemple : 'man sh' A ma connaissance, il y a deux syntaxes différentes, celle de sh (ksh, ...) et celle de csh (tcsh, ...).
Lorsque l'on veut réaliser le même traitement sur plusieurs fichiers, il peut être intéressant de réaliser une boucle. Le problèmes est que la syntaxe de ces boucles dépend du shell utilisé.
La syntaxe est la suivante :
for identifier [in word...] ;do list ;done
Each time a for command is executed, identifier is set to the next word
taken from the in word list. If in word ... is omitted, the for com-
mand executes the do list once for each positional parameter that is
set. (See Parameter Substitution.) Execution ends when there are no
more words in the list.
Par exemple, la commande ci-dessous
cajal-%\!%% for f in .*rc ; do echo $f ; done
renvoie le nom de chacun des fichiers de la forme .*rc. En
fait chacun des noms de ces fichiers est successivement rangé dans
la variable f. On accède ensuite à sa valeur par $f.
On peut aussi exécuter plusieurs commandes
for f in .*rc ; do ls -l $f ; echo $f ; done
Plutôt que de taper l'ensemble de la boucle sur une seule ligne de
commande, on peut aussi la taper sur plusieurs lignes :
cajal-%\!%% for f in .*rc
> do
> ls -l $f
> echo $f
> done
Autre exemple, les commandes ci-dessous compilent les fichiers C
(*/*/*.c) et rangent les objets dans les mêmes répertoires. Les noms
des fichiers objet sont recréés grâce aux commandes dirname
et basename
cajal-%\!%% for f in */*/*.c
> do
> cc -c $f -o `dirname $f`/`basename $f .c`.o
> done
La syntaxe est la suivante :
while list ;do list ;done
until list ;do list ;done
Executes the while list repeatedly, and if the exit status of the last
command in the list is 0 (zero), executes the do list; otherwise the
loop terminates. If no commands in the do list are executed, then the
while command returns a 0 (zero) exit status; The keyword until can be
used in place of while to negate the loop termination test.
Par exemple,
cajal-%\!%% i=0
cajal-%\!%% while [ $i -le 10 ]
> do
> echo $i
> i=`expr $i + 1`
> done
va écrire les nombres de 0 à 10.
La syntaxe est la suivante :
if list ;then list [elif list ;then list] ... [;else list] ;fi
Executes the list following if and, if it returns a 0 (zero) exit
status, executes the list following the first then. Otherwise, the
list following elif is executed and, if its value is 0 (zero), the list
following the next then is executed. Failing that, the else list is
executed. If no else list or then list is executed, then the if com-
mand returns a 0 (zero) exit status.
Par exemple,
cajal-%\!%% i=0
cajal-%\!%% while [ $i -le 20 ]
> do
> if [ $i -lt 10 ]; then echo -n 0;fi
> echo $i
> i=`expr $i + 2`
> done
va écrire les nombres de 2 en 2 de 0 à 20 et ajoutera un 0 devant les
nombres plus petit que 10 (écrira donc 00, 02, 04, 06, 08, 10 ...).
On peut évidemment aussi écrire
cajal-%\!%% i=0
cajal-%\!%% while [ $i -le 20 ]
> do
> if [ $i -lt 10 ]
> then
> echo -n 0
> fi
> echo $i
> i=`expr $i + 2`
> done
Autre exemple,
cajal-%7%% for f in *
> do
> if [ -d $f ]
> then
> ls -ld $f
> fi
> done
va lister les sous-répertoires du répertoire courant.
Elles sont entre crochets [...]. Le manual ,man,
nous donne la syntaxe :
-a file
TRUE, if file exists.
-b file
TRUE, if file exists and is a block-special file.
-c file
TRUE, if file exists and is a character-special file.
-d file
TRUE, if file exists and is a directory.
-e file
TRUE, if file exists.
-f file
TRUE, if file exists and is an ordinary file.
-g file
TRUE, if file exists and has its setgid bit set.
-G file
TRUE, if file exists and its group matches the effective group ID of
this process.
-k file
TRUE, if file exists and has its sticky bit set.
-L file
TRUE, if file exists and is a symbolic link.
-n string
TRUE, if length of string is nonzero.
-o option
TRUE, if option named option is on.
-O file
TRUE, if file exists and is owned by the effective user ID of this pro-
cess.
-p file
TRUE, if file exists and is a FIFO special file or a pipe.
-r file
TRUE, if file exists and is readable by current process.
-s file
TRUE, if file exists and has size greater than 0 (zero).
-S file
TRUE, if file exists and is a socket.
-t file_des
TRUE, if file descriptor number file_des is open and associated with a
terminal device.
-u file
TRUE, if file exists and has its setuid bit set.
-w file
TRUE, if file exists and is writable by current process.
-x file
TRUE, if file exists and is executable by current process. If file
exists and is a directory, then the current process has permission to
search in the directory.
-z string
TRUE, if length of string is 0 (zero).
file1 -nt file2
TRUE, if file1 exists and is newer than file2.
file1 -ot file2
TRUE, if file1 exists and is older than file2.
file1 -ef file2
TRUE, if file1 and file2 exist and refer to the same file.
string = pattern
TRUE, if string matches pattern.
string != pattern
TRUE, if string does not match pattern.
string1 < string2
TRUE, if string1 collates before string2.
string1 > string2
TRUE, if string1 collates after string2.
expression1 -eq expression2
TRUE, if expression1 is equal to expression2.
expression1 -ne expression2
TRUE, if expression1 is not equal to expression2.
expression1 -lt expression2
TRUE, if expression1 is less than expression2.
expression1 -gt expression2
TRUE, if expression1 is greater than expression2.
expression1 -le expression2
TRUE, if expression1 is less than or equal to expression2.
expression1 -ge expression2
TRUE, if expression1 is greater than or equal to expression2.
A compound expression can be constructed from these primitives by using any
of the following, listed in decreasing order of precedence.
(expression)
TRUE, if expression is TRUE. Used to group expressions.
! expression
TRUE if expression is FALSE.
expression1 && expression2
TRUE, if expression1 and expression2 are both TRUE.
expression1 || expression2
TRUE, if either expression1 or expression2 is TRUE.
La syntaxe est la suivante :
case word in [[(] pattern [| pattern] ...) list ;;] ... esac
Executes the list associated with the first pattern that matches word.
The form of the patterns is the same as that used for file name genera-
tion.
les redirection se fond en utilisant directement les file
descriptors 1 et 2 (correspondant respectivement à
stdout et stderr).
Par exemple, considérons l'exécutable a.out obtenu après
compilation du code suivant:
#include < stdio.h >
main()
{
fprintf( stdout, "stdout\n" );
fprintf( stderr, "stderr\n" );
}
L'ordre d'écriture est important:
selon l'ordre des redirections, l'effet sera différent.
Redirige stdout dans la fenêtre (défaut) | Redirige stderr dans la fenêtre (défaut) | % a.out | |
Redirige stdout dans la fenêtre (défaut) | Redirige stderr dans stdout | % a.out 2>&1 | |
% a.out 2>&1 | more | |||
# les 2 sorties peuvent alors être "pipées" dans more | |||
# stderr est alors écrit avant stdout | |||
Redirige stdout dans la fenêtre (défaut) | Redirige stderr dans un fichier ('out-2') | % a.out 2> out-2 | |
% a.out 2> out-2 | more | |||
# stdout seul sera "pipé" dans more | |||
Redirige stdout dans un fichier ('out-1') | Redirige stderr dans la fenêtre (défaut) | % a.out > out-1 | |
Redirige stdout dans un fichier ('out-1') | Redirige stderr dans stdout (dans la fenêtre) | % a.out 2>&1 > out-1 | |
# Attention à l'ordre stderr est redirigé dans stdout | |||
# alors que celui-ci n'est pas encore redirigé, c'est pour cela | |||
# que c'est écrit dans la fenêtre | |||
% a.out 2>&1 > out-1 | more | |||
# stderr seul sera "pipé" dans more | |||
Redirige stdout dans un fichier ('out-1') | Redirige stderr dans un fichier ('out-2') | % a.out 2> out-2 > out-1 | |
Redirige stdout dans un fichier ('out-1') | Redirige stderr dans le même fichier ('out-1') | % a.out > out-1 2>&1 | |
# Attention à l'ordre stderr est redirigé dans stdout | |||
# alors que celui-ci est déjà redirigé, c'est pour cela | |||
# que c'est écrit dans le même fichier | |||
stderr est alors écrit avant stdout |
La syntaxe est la suivante :
foreach name (word_list)
...
end
Par exemple, la commande ci-dessous
% foreach f ( .*rc )
? echo $f
? end
renvoie le nom de chacun des fichiers de la forme .*rc. En
fait chacun des noms de ces fichiers est successivement rangé dans
la variable f. On accède ensuite à sa valeur par $f.
La syntaxe est la suivante :
while (expression)
...
end
Par exemple,
% set i=0
% while ( $i <= 10 )
? echo $i
? set i=`expr $i + 1`
? end
va écrire les nombres de 0 à 10.
Les syntaxes sont les suivantes :
if (expression) command
Executes the single command (including its arguments) if the specified
expression evaluates TRUE. Variable substitution on command happens
early, at the same time it does for the rest of the if command. The
command argument must be a simple command (rather than a pipeline, com-
mand list, alias, or parenthesized command list). Note that
input/output redirection occurs even if expression is FALSE and command
is not executed.
if (expression) then
...
else if (expression2) then
...
else
...
endif
Par exemple,
% set i=0
% while ( $i <= 20 )
? if ( $i < 10 ) echo -n 0
? echo $i
? set i=`expr $i + 2`
? end
va écrire les nombres de 2 en 2 de 0 à 20 et ajoutera un 0 devant les
nombres plus petit que 10 (écrira donc 00, 02, 04, 06, 08, 10 ...).
On peut évidemment aussi écrire
% set i=0
% while ( $i <= 20 )
? if ( $i < 10 ) then
? echo -n 0
? endif
? echo $i
? set i=`expr $i + 2`
? end
Autre exemple,
> foreach f ( * )
foreach? if -d $f ls -ld $f
foreach? end
va lister les sous-répertoires du répertoire courant.
Le manual ,man,
nous donne la syntaxe :
Expressions
The built-in commands @, exit, if, and while accept expressions that
include operators similar to those of C, but with a precedence from right
to left instead of from left to right. The following operators are avail-
able:
( )
~
!
* / %
+ -
<< >>
<= >= < >
== != =~ !~
&
^
|
&&
||
In the preceding list, operators of equal precedence appear on the same
line, below those lines containing operators (if any) that have greater
precedence, and above those lines containing operators having lesser pre-
cedence. The ==, !=, =~, and !~ operators compare their arguments as
strings; all others operate on numbers. The =~ and !~ operators are simi-
lar to != and ==, except that the rightmost side is a pattern against which
the left-hand operand is matched. This reduces the need for use of the
switch statement in shell scripts when all that is really needed is pattern
matching.
Null or missing arguments are considered 0 (zero). The result of all
expressions are strings, which represent decimal numbers. It is important
to note that no two components of an expression can appear in the same
word. Except when next to components of expressions that are syntactically
significant to the parser (&, |, <, >, -, (, and ) ) expression components
should be surrounded with spaces.
Also available in expressions as primitive operands are command executions
enclosed in { and } and file inquiries of the form -l name where l is one
of the following:
r Read access
w Write access
x Execute access
e Existence
o Ownership
z Zero size
f Plain file
d Directory
l Symbolic link
La syntaxe est la suivante :
switch (string)
case string1: ...
breaksw ...
default: ...
breaksw
endsw
From tcsh man
The standard input and standard output of a command may be redirected with the following
syntax:
< name Open file name (which is first variable, command and filename expanded) as the
standard input.
<< word Read the shell input up to a line which is identical to word. word is not subjected
to variable, filename or command substitution, and each input line is compared to
word before any substitutions are done on this input line. Unless a quoting `\',
`"', `' or ``' appears in word variable and command substitution is performed on
the intervening lines, allowing `\' to quote `$', `\' and ``'. Commands which are
substituted have all blanks, tabs, and newlines preserved, except for the final
newline which is dropped. The resultant text is placed in an anonymous temporary
file which is given to the command as standard input.
> name
>! name
>& name
>&! name
The file name is used as standard output. If the file does not exist then it is
created; if the file exists, its is truncated, its previous contents being lost.
If the shell variable noclobber is set, then the file must not exist or be a char
Par exemple, considérons l'exécutable a.out obtenu après
compilation du code suivant:
#include
Redirige stdout dans la fenêtre (défaut) | Redirige stderr dans la fenêtre (défaut) | % a.out | |
Redirige stdout dans la fenêtre (défaut) | Redirige stderr dans stdout | ??? | |
% a.out |& more | |||
# les 2 sorties peuvent alors être "pipées" dans more | |||
# stderr est alors écrit avant stdout | |||
Redirige stdout dans la fenêtre (forcé) | Redirige stderr dans un fichier ('out-2') | % ( a.out > /dev/tty ) >& out-2 | |
Redirige stdout dans un fichier ('out-1') | Redirige stderr dans la fenêtre (défaut) | % a.out > out-1 | |
Redirige stdout dans un fichier ('out-1') | Redirige stderr dans stdout (dans la fenêtre) | ??? | |
% ( a.out > out-1 ) |& more | |||
# stderr seul sera "pipé" dans more | |||
Redirige stdout dans un fichier ('out-1') | Redirige stderr dans un fichier ('out-2') | % ( a.out > out-1 ) >& out-2 | |
Redirige stdout dans un fichier ('out-1') | Redirige stderr dans le même fichier ('out-1') | % a.out >& out-1 | |
stderr est alors écrit avant stdout |
Les commandes peuvent être regroupées dans un fichier, qui pourra
ensuite être exécuté. Pour cela utiliser
'chmod +x' pour lui donner la permission d'être exécuté.
La première ligne du fichier peut alors spécifier le shell avec lequel
vous voulez interpréter les commandes du fichier.
Par exemple, un fichier de commandes commencant par
#!/bin/sh
interprétera les commandes en sh,
tandis que
#!/bin/bash
fera que les commandes du fichier seront interprétées en bash.
Pour plus d'information, man.
NAME
awk - Pattern scanning and processing language
SYNOPSIS
awk [-F ERE] [-f program_file]... [-v var=val]... [argument]...
awk [-F ERE] [-v var=val]... ['program_text'] [argument]...
...
awk permet par exemple de sélectionner la
ième chaîne de caractère d'une ligne,
par exemple
cajal-%32%% ls -lt | awk '{print $5}'
permet de ne voir que la taille des fichiers.
cajal-%32%% ls -lt | awk '{print $9 " a pour taille " $5}'
est encore plus précis quant à ce qu'il fait. Pour ne voir
que les vrais fichiers, on peut faire quelque chose
comme
cajal-%33%% ls -lF | grep -v -e "/" -e "@" -e "*" | awk '{print $9 " a pour taille " $5}'
Et pour encore mieux formatter la sortie
cajal-%34%% ls -lF | grep -v -e "/" -e "@" -e "*" | awk '{printf "%-30s a pour taille %10d\n", $9, $5}'
NAME
basename, dirname - Returns the base file name or directory portion of a
path name
SYNOPSIS
basename string [suffix]
dirname string
Exemple (sh), les commandes ci-dessous copient les fichiers
en changeant l'extension latex en tex.
cajal-%\!%% for f in *.latex
> do
> cp $f `basename $f .latex`.tex
> done
NAME
basename, dirname - Returns the base file name or directory portion of a
path name
SYNOPSIS
basename string [suffix]
dirname string
Exemple (sh), les commandes ci-dessous compilent les fichiers C
(*/*/*.c) et rangent les objets dans les mêmes répertoires. Les noms
des fichiers objet sont recréés grâce aux commandes dirname
et basename
cajal-%\!%% for f in */*/*.c
> do
> cc -c $f -o `dirname $f`/`basename $f .c`.o
> done
Permet d'évaluer des expressions en particulier des expressions
numériques, uniquement entières.
Exemples (sh) :
cajal-%\!%% i=0 ; while [ $i -lt 10 ] ; do echo $i ; i=`expr $i + 1` ; done
va écrire les nombres de 0 à 9.
cajal-%\!%% i=1; while [ $i -le 100 ] ; do echo $i ; i=`expr $i \* 10` ; done
va écrire les nombres 1, 10 et 100.
Le manual ,man,
nous donne la syntaxe :
expression1 \| expression2
Returns expression1 if it is neither null nor 0 (zero); otherwise,
returns expression2.
expression1 \& expression2
Returns expression1 if neither expression1 nor expression2 is null nor
0; otherwise, returns 0.
expression1 { =, \>, \>=, \<, \<=, != } expression2
Returns the result of an integer comparison if both expressions are
integers; otherwise, returns the result of a string comparison.
expression1 {+, - } expression2
Adds or subtracts integer-valued arguments.
expression1 { \*, /, % } expression2
Multiplies, divides, or provides the remainder from the division of
integer-valued arguments.
expression1 : expression2 or match expression1 expression2
Compares expression1 with expression2, which must be a regular expres-
sion, with syntax as described for grep, except that all patterns are
anchored, so ^ (circumflex) (which anchors a pattern to the beginning
of a line) is not a special character in this context.
Normally, the matching operator returns the number of characters
matched. Alternatively, you can use the \(...\) symbols in expression2
to return a portion of expression1.
(expression)
Provides expression grouping.
Le manual ,man,
nous donne la syntaxe :
NAME
find - search for files in a directory hierarchy
SYNOPSIS
find [path...] [expression]
DESCRIPTION
...
Cette commande est très pratique pour rechercher des fichiers
dans une arborescences. On peut spécifier le nom, la taille,
le type, etc.
Les exemples qui suivent (pêchés dans le man) montrent déjà une
grande variété d'utilisations de find.
De nombreuses options (cf le man), comme -follow qui permet
de suivre les liens dynamiques, ou comme
-exec qui permettent d'exécuter une commande sur le fichier
trouvé, existent, qui ne sont pas forcément dans les exemples ci-dessous.
willis-%\9%% find . -size +1000k -exec gzip {} \;
va rechercher récursivement (à partir de ./) les fichiers de plus de
1000 koctets (1 mégaoctets) et va les compresser.
willis-%\9%% find . \( -name *~ -o -name *.o \) -exec rm {} \;
va rechercher récursivement les fichiers *~ et *.o pour les effacer.
EXAMPLES (from the man page)
1. To list all files in the file system with a given base file name,
enter:
find / -name .profile -print
This searches the entire file system and writes the complete path
names of all files named .profile. The / (backslash) tells find to
search the root directory and all of its subdirectories. This may
take a while, so it is best to limit the search by specifying the
directories where you think the files might be.
2. To list the files with a specific permission code in the current
directory tree, enter:
find . -perm 0600 -print
This lists the names of the files that have only owner-read and
owner-write permission. The . (dot) tells find to search the current
directory and its subdirectories. See the chmod(1) reference page for
details about permission codes.
3. To search several directories for files with certain permission codes,
enter:
find manual clients proposals -perm -0600 -print
This lists the names of the files that have owner-read and owner-write
permission and possibly other permissions. The directories manual,
clients, and proposals, and their subdirectories, are searched. Note
that -perm 0600 in the previous example selects only files with per-
mission codes that match 0600 exactly. In this example, -perm -0600
selects files with permission codes that allow at least the accesses
indicated by 0600. This also matches the permission codes 0622 and
2744.
4. To search for regular files with multiple links, enter:
find . -type f -links +1 -print
This lists the names of the ordinary files (-type f) that have more
than one link (-links +1). Note that every directory has at least two
links: the entry in its parent directory and its own . (dot) entry.
See the ln command for details about multiple file links.
5. To find all accessible files whose path name begins with find, enter:
find find -print
6. To remove all files named a.out or *.o that have not been accessed for
a week and that are not mounted using nfs, enter:
find / \( -name a.out -o -name '*.o' \) -atime +7 -exec \
rm {} \; -o -fstype nfs -prune
7. To find all files modified within the last 24 hours, enter:
find . -mtime 1 -print
8. To find all files on the root file system, enter:
find / -mount -print
9. To write all the files on the root file system to tape, enter:
find / -mount -print -cpio /dev/rmt?h
cpio -iBvt < /dev/rmt?h
10. To find all the mount points on the root file system, enter:
find / ! -mount -print
11. The next several examples show how to build complex expressions using
the available operators. These examples use the directory structure
that follows:
% ls -al
total 77
drwxr-xr-x 9 me users 8192 Nov 6 17:28 .
drwxrwxrwx 47 me users 8192 Nov 6 13:30 ..
-rw-r--r-- 1 me users 1559 Dec 23 1996 7
-rw-r--r-- 1 me users 7 May 30 12:22 abc
-rw-r--r-- 1 me users 0 Nov 5 17:44 ccc
drwxr-xr-x 2 me users 8192 Apr 6 1997 crn
drwxr-xr-x 3 me users 8192 Mar 23 1997 crypto
drwxr-xr-x 2 me users 8192 Sep 12 14:24 exp
-rwx--x--x 1 me users 0 Nov 1 1996 filea
---x-w--wx 1 me users 0 Nov 1 1996 fileb
-rw-r--r-- 1 me adm 0 Jun 13 13:43 filek
-rwxr-xr-x 1 me users 216 Nov 1 1996 filet
-rw-r--r-- 1 me users 0 Nov 6 17:35 find
-rw-r--r-- 1 me adm 0 Jun 13 13:43 gfilek
-rwxr-xr-x 1 me users 216 Nov 6 17:28 gfilet
drwxr-xr-x 2 me users 8192 Oct 23 13:49 h4d
-rw-r--r-- 1 me adm 0 Jun 13 13:43 hfilek
drwxr-xr-x 2 me users 8192 Oct 23 11:50 resume
drwxr-xr-x 2 me users 8192 Sep 8 13:31 timtst
-rw-r--r-- 1 me users 0 Nov 6 17:25 typescript
drwxr-xr-x 2 me users 8192 Dec 18 1996 wordgame
12. The following example finds all files that have a name starting with
file. Notice that the asterisk must be escaped to prevent the shell
from interpreting it as a special character.
% find . -name file\*
./filea
./fileb
./filet
./filek
13. The following example finds all files that have a name starting with
file and an owning group of adm. Notice that this is the default
behavior, and is identical to the next example using the -a operator.
% find . -name file\* -group adm
./filek
14. The following example finds all files that have a name starting with
file and an owning group of adm. Notice that this is identical to the
prior example of the default behavior.
% find . -name file\* -a -group adm
./filek
15. The following example finds all files that have a name starting with
file or that have an owning group of adm.
% find . -name file\* -o -group adm
./filea
./fileb
./filet
./filek
./gfilek
./hfilek
16. The following example finds all files that have a name starting with
file or that have an owning group of adm and a name starting with gf.
% find . -name file\* -o -group adm -name gf\*
./filea
./fileb
./filet
./filek
./gfilek
17. The following example finds all files that have a name starting with
file and that have an owning group of adm or a name starting with gf.
% find . -name file\* -a -group adm -o -name gf\*
./filek
./gfilek
./gfilet
18. The following example finds all files that have an owning group other
than the group users.
% find . ! -group users
./filek
./gfilek
./hfilek
19. The following example finds all files owned by the group users and
that have a name starting with file or that have a name starting with
cc.
% find . \( -group users -a -name file\* \) -o -name cc\*
./filea
./fileb
./filet
./ccc
20. The following example finds all files not owned by the group users and
that have a name starting with file or that have a name starting with
cc.
% find . \( ! -group users -a -name file\* \) -o -name cc\*
./filek
./ccc
NAME
grep, egrep, fgrep - Searches a file for patterns
SYNOPSIS
grep [-E|-F] [-c|-l|-q] [-bhinsvwxy] [-pparagraph_separator] -e
pattern_list [-e pattern_list]... [-f pattern_file]... [file...]
grep [-E|-F] [-c|-l|-q] [-bhinsvwxy] [-pparagraph_separator] [-e
pattern_list]... -f pattern_file [-f pattern_file]... [file...]
grep [-E|-F] [-c|-l|-q] [-bhinsvwxy] [-pparagraph_separator] pattern_list
[file...]
...
NAME
ls - Lists and generates statistics for files
SYNOPSIS
ls [-aAbcCdfFgilLmnopqrRstux1] [file ... | directory ...]
...
FLAGS
-a Lists all entries in the directory, including the entries that begin
with a . (dot). Entries that begin with a . are not displayed unless
you refer to them specifically, or you specify the -a flag.
...
-d Displays only the information for the directory that is named, rather
than for its contents. This is useful with the -l flag to get the
status of a directory.
...
-F Puts a / (slash) after each file name if the file is a directory, an *
(asterisk) after each file name if the file can be executed, an =
(equal sign) after each file name if the file is a socket, and an @ (at
sign) for a symbolic link, and a | (vertical bar) for a FIFO.
...
-l Displays the mode, number of links, owner, group, size (in bytes), and
time of last modification for each file, and path name. If the file is
a special file, the size field instead contains the major and minor
device numbers. If the file is a symbolic link, the path name of the
linked-to file is also printed preceded by ->. The attributes of the
symbolic link are displayed. The -n flag overrides the -l flag.
-L Lists the file or directory the link references rather than
the link itself, if the argument is a symbolic link.
...
-p Puts a slash after each file name if that file is a directory.
...
-R Lists all subdirectories recursively.
...
-t Sorts by time of last modification (latest first) instead of by name.
...
NAME
sed - Stream editor
SYNOPSIS
sed [-n] script [file...]
sed [-n] [-e script]...[-f script_file...]...[file...]
The sed utility is a stream editor that reads one or more text files, makes
editing changes according to a script of editing commands and writes the
results to standard output.
...