PowerShell : Get the most recently modified file for each directories

get the most recently modified file for each directories

The most efficient way to work on Windows is using PowerShell.

You can do virtually anything with it. I’m just a newbie with PowerShell but here is how I work to construct complex commands with some basic knowledge.

Say I have some directories under D:\tmp and I want to know the more recently modified file for each directory.

First I have to list the content of my directory, so I use Get-ChildItem command (get-help Get-ChildItem for more information) :

PS C:\> Get-ChildItem D:\tmp\scripts -Recurse -ErrorAction SilentlyContinue
 
Répertoire : D:\tmp\scripts
 
Mode LastWriteTime Length Name
 
---- ------------- ------ ----
 
d---- 12/07/2012 17:28 LOGS
 
-a--- 12/07/2012 17:28 1421 crdb1.sh
 
-a--- 12/07/2012 17:28 526 crdb2.sh
 
-a--- 12/07/2012 17:28 1245 crdb3.sh
 
-a--- 12/07/2012 17:28 1368 crdb4.sh
 
-a--- 12/07/2012 17:28 613 env.sh
 
-a--- 12/07/2012 17:28 1034 initBDD.ora
 
-a--- 12/07/2012 17:28 651 BDD.sh
 
-a--- 12/07/2012 17:28 169 BDD.sql
 
Répertoire : D:\tmp\scripts\LOGS
 
Mode LastWriteTime Length Name
 
---- ------------- ------ ----
 
-a--- 12/07/2012 17:28 1579 crdb1_BDD.log

-Recurse will list recursively the directory, and -ErrorAction SilentlyContinue will ensure that the script will continue even if an error is raised.

Then I want only to work with files, so I use the property “PsIsContainer “ of the current object in the pipe (which is $_ similarly to Perl language).

I will add the “Where” statement to only select object that are not (so “!”) Containers (directories).

PS C:\> Get-ChildItem D:\tmp\scripts -Recurse -ErrorAction SilentlyContinue | Where {!$_.PsIsContainer}
 
Répertoire : D:\tmp\scripts
 
Mode LastWriteTime Length Name
 
---- ------------- ------ ----
 
-a--- 12/07/2012 17:28 1421 crdb1.sh
 
-a--- 12/07/2012 17:28 526 crdb2.sh
 
-a--- 12/07/2012 17:28 1245 crdb3.sh
 
-a--- 12/07/2012 17:28 1368 crdb4.sh
 
-a--- 12/07/2012 17:28 613 env.sh
 
-a--- 12/07/2012 17:28 1034 initBDD.ora
 
-a--- 12/07/2012 17:28 651 BDD.sh
 
-a--- 12/07/2012 17:28 169 BDD.sql
 
Répertoire : D:\tmp\scripts\LOGS
 
Mode LastWriteTime Length Name
 
---- ------------- ------ ----
 
-a--- 12/07/2012 17:28 1579 crdb1_BDD.log

From here I select the name of the columns I want to display to build a table:

PS C:\> Get-ChildItem D:\tmp\scripts -Recurse -ErrorAction SilentlyContinue | Where {!$_.PsIsContainer}|select Name,DirctoryName, LastWriteTime
 
Name DirectoryName LastWriteTime
 
---- ------------- -------------
 
crdb1.sh D:\tmp\scripts 12/07/2012 17:28:13
 
crdb2.sh D:\tmp\scripts 12/07/2012 17:28:13
 
crdb3.sh D:\tmp\scripts 12/07/2012 17:28:13
 
crdb4.sh D:\tmp\scripts 12/07/2012 17:28:13
 
env.sh D:\tmp\scripts 12/07/2012 17:28:12
 
initBDD.ora D:\tmp\scripts 12/07/2012 17:28:13
 
BDD.sh D:\tmp\scripts 12/07/2012 17:28:12
 
BDD.sql D:\tmp\scripts 20/08/2012 15:52:25
 
crdb1_BDD.log D:\tmp\scripts\LOGS 12/07/2012 17:28:13

Sort them and only keep the most recent file :

PS C:\> Get-ChildItem D:\tmp\scripts -Recurse -ErrorAction SilentlyContinue | Where {!$_.PsIsContainer}|select Name,Dirc
 
toryName, LastWriteTime |Sort LastWriteTime -descending | select -first 1
 
Name DirctoryName LastWriteTime
 
---- ------------ -------------
 
BDD.sql 20/08/2012 15:52:25

Now I have the name and most recently modified file of the directory.

If I want to do that on multiple directories, I will have to loop on every directory.

So I list all the objects of the upper directory and select only the Containers (or Directories).

PS C:\> Get-ChildItem d:\tmp\* | Where {$_.PsIsContainer}
 
Répertoire : D:\tmp
 
Mode LastWriteTime Length Name
 
---- ------------- ------ ----
 
d---- 16/07/2012 15:19 cpu-z_1.55-64bits-en
 
d---- 19/07/2012 18:39 my07xx
 
d---- 07/06/2012 14:47 graphs
 
d---- 12/07/2012 17:28 scripts
 
d---- 01/06/2012 17:24 SDD
 
d---- 15/05/2012 12:05 sqr

Then for each directory found you have to run the previous command. $_ will refer to the current directory on the foreach statement :

PS C:\> Get-ChildItem d:\tmp\* | Where {$_.PsIsContainer} | foreach-object { Get-ChildItem $_ -Recurse -ErrorAction Sile
 
ntlyContinue | Where {!$_.PsIsContainer} | Select Name,DirectoryName, LastWriteTime, Mode | Sort LastWriteTime -descend
 
ing | select -first 1}
 
Name DirectoryName LastWriteTime Mode
 
---- ------------- ------------- ----
 
cpuz_readme.txt D:\tmp\cpu-z_1.55-64bits-en 09/07/2010 15:15:08 -a---
 
check_tinacat.ksh D:\tmp\my07xx 19/07/2012 18:39:18 -a---
 
tmpgraph.png D:\tmp\graphs\graphs\nmon_... 07/06/2012 14:39:04 -a---
 
BDD.sql D:\tmp\scripts 20/08/2012 15:52:25 -a---
 
deploysqrscript.txt D:\tmp\sqr 20/08/2012 16:09:47 -a---

On each line you will have the last modified file found for each directory under directly under “d:\tmp”

Command :

Get-ChildItem d:\tmp\* | Where {$_.PsIsContainer} | foreach-object { Get-ChildItem $_ -Recurse -ErrorAction SilentlyContinue | Where {!$_.PsIsContainer} | Select Name,DirectoryName, LastWriteTime, Mode | Sort LastWriteTime -descending | select -first 1}

Installing Proftpd on Red-Hat EL 5 or 6

Installing proftpd on Red-Hat EL 5 or 6

Proftpd is one of the best an most wildly used ftp server on unix-like platforms.
You can find proftpd already packaged for many distributions.

Packaged software are easy to install and time saving but if you want the latest version and/or a custom install with specific options you will have to go through source compiling.

First download the latest version:

# wget "ftp://ftp.solnet.ch/mirror/proftpd.org/distrib/source/proftpd-1.3.4a.tar.bz2"
Download the md5 file to check the file data integrity:
# cat proftpd-1.3.4a.tar.bz2.md5
4e3235dc1ef95d36e59721d70c5c489c proftpd-1.3.4a.tar.bz2
# md5sum proftpd-1.3.4a.tar.bz2
4e3235dc1ef95d36e59721d70c5c489c proftpd-1.3.4a.tar.bz2

Unzip and mv the sources on /usr/local/src/ :

# bunzip2 proftpd-1.3.4a.tar.bz2
# tar xvf proftpd-1.3.4a.tar.gz
# mv proftpd-1.3.4a /usr/local/src/

Check if you have gcc rpm :

# rpm -qa|grep gcc
gcc-4.4.5-6.el6.x86_64

You may need to install other packages depending on what you already installed and the the proftpd options you will choose.

# cd /usr/src/local/proftpd-1.3.4a/

Read the install documentation:

# more INSTALL

Run the configuration.
I use –prefix= force proftd to install on /usr/local/proftpd and –enable-autoshadow to be able to use standard and shadow passwords.

# ./configure --prefix=/usr/local/proftpd --enable-autoshadow
# echo $?
0

Build proftpd :

# make
echo \#define BUILD_STAMP \"`date +"%a %b %e %Y %H:%M:%S %Z"`\" > include/buildstamp.h
cd lib/ && make lib
make[1]: Entering directory `/usr/src/proftpd-1.3.4a/lib'
gcc -DHAVE_CONFIG_H -DLINUX -I.. -I../include -O2 -Wall -c pr_fnmatch.c
gcc -DHAVE_CONFIG_H -DLINUX -I.. -I../include -O2 -Wall -c sstrncpy.c
...
...
gcc -DHAVE_CONFIG_H -DLINUX -I.. -I../include -O2 -Wall -c ftpwho.c
make[1]: Leaving directory `/usr/src/proftpd-1.3.4a/utils'
gcc -L./lib -o ftpcount utils/ftpcount.o utils/scoreboard.o utils/misc.o -lsupp -lcrypt -ldl
gcc -L./lib -o ftpdctl src/ftpdctl.o src/pool.o src/str.o src/netaddr.o src/log.o src/ctrls.o -lsupp -lcrypt -ldl -L./lib/libcap -lcap
gcc -L./lib -o ftpscrub utils/ftpscrub.o utils/scoreboard.o utils/misc.o -lsupp -lcrypt -ldl
gcc -L./lib -o ftpshut utils/ftpshut.o -lsupp -lcrypt -ldl
gcc -L./lib -o ftptop utils/ftptop.o utils/scoreboard.o utils/misc.o -lsupp -lcrypt -ldl
gcc -L./lib -o ftpwho utils/ftpwho.o utils/scoreboard.o utils/misc.o -lsupp -lcrypt -ldl
[root@frsu0069 proftpd-1.3.4a]# echo $?
0

Install it:

# make install
cd lib/ && make lib
make[1]: Entering directory `/usr/src/proftpd-1.3.4a/lib'
make[1]: Nothing to be done for `lib'.
make[1]: Leaving directory `/usr/src/proftpd-1.3.4a/lib'
cd src/ && make src
make[1]: Entering directory `/usr/src/proftpd-1.3.4a/src'
make[1]: Nothing to be done for `src'.
make[1]: Leaving directory `/usr/src/proftpd-1.3.4a/src'
cd modules/ && make static
make[1]: Entering directory `/usr/src/proftpd-1.3.4a/modules'
make[1]: Leaving directory `/usr/src/proftpd-1.3.4a/modules'
test -z """" -a -z """" || (cd modules/ && make shared)
make[1]: Entering directory `/usr/src/proftpd-1.3.4a/lib/libcap'
make[1]: Nothing to be done for `all'.
make[1]: Leaving directory `/usr/src/proftpd-1.3.4a/lib/libcap'
...
...
cd lib/ && make install
make[1]: Entering directory `/usr/src/proftpd-1.3.4a/lib'
make[1]: Nothing to be done for `install'.
make[1]: Leaving directory `/usr/src/proftpd-1.3.4a/lib'
/usr/bin/install -c -o root -g root -m 0644 config.h /usr/local/proftpd/include/proftpd/config.h
cd include/ && make install
make[1]: Entering directory `/usr/src/proftpd-1.3.4a/include'
make[1]: Leaving directory `/usr/src/proftpd-1.3.4a/include'
/usr/bin/install -c -o root -g root -m 0644 proftpd.pc /usr/local/proftpd/lib/pkgconfig/proftpd.pc
test -z """" || (cd locale/ && make install)
[root@frsu0069 proftpd-1.3.4a]# echo $?
0

Proftpd is now installed :

# ls /usr/local/proftpd
bin etc include lib libexec sbin share var

Copy the man pages in the appropriate directories (so you can use them) :

# cd /usr/local/proftpd/share/man/man1
# cp * /usr/share/man/man1/
# cd ../man5
# cp * /usr/share/man/man5/
# cd ../man8
# cp * /usr/share/man/man8/

Test proftpd with the embedded test procedure:

# sh /usr/local/src/proftpd-1.3.4a/sample-configurations/PFTEST.install
Sample test files successfully installed in /tmp/PFTEST.

The script purpose is to create a sample configuration file “PFTEST.conf” in /tmp/PFTEST
Run proftpd :

# /usr/local/proftpd/sbin/proftpd -n -d 5 -c /tmp/PFTEST/PFTEST.conf

(-n for “don’t start as daemon” and -d 5 for debug level “medium”)
Now connect with an ftp client to port 2012 with login proftpd and password proftpd :
on the server you will something like :

# /usr/local/proftpd/sbin/proftpd -n -d 5 -c /tmp/PFTEST/PFTEST.conf
FRSU0001 proftpd[18003]: using TCP receive buffer size of 87380 bytes
FRSU0001 proftpd[18003]: using TCP send buffer size of 16384 bytes
FRSU0001 proftpd[18003]: : using 'mod_ident.c' section at line 32
FRSU0001 proftpd[18003]: : adding section for resolved path '/'
FRSU0001 proftpd[18003] 192.168.0.111:
FRSU0001 proftpd[18003] 192.168.0.111: Config for ProFTPD TEST Installation:
FRSU0001 proftpd[18003] 192.168.0.111: /
FRSU0001 proftpd[18003] 192.168.0.111: AllowOverwrite
FRSU0001 proftpd[18003] 192.168.0.111: TransferLog
FRSU0001 proftpd[18003] 192.168.0.111: RequireValidShell
FRSU0001 proftpd[18003] 192.168.0.111: UseFtpUsers
FRSU0001 proftpd[18003] 192.168.0.111: WtmpLog
FRSU0001 proftpd[18003] 192.168.0.111: Umask
FRSU0001 proftpd[18003] 192.168.0.111: DefaultServer
FRSU0001 proftpd[18003] 192.168.0.111: UserID
FRSU0001 proftpd[18003] 192.168.0.111: UserName
FRSU0001 proftpd[18003] 192.168.0.111: GroupID
FRSU0001 proftpd[18003] 192.168.0.111: GroupName
FRSU0001 proftpd[18003] 192.168.0.111: AuthUserFile
FRSU0001 proftpd[18003] 192.168.0.111: AuthGroupFile
FRSU0001 proftpd[18003] 192.168.0.111: PidFile
FRSU0001 proftpd[18003] 192.168.0.111: TransferLog
FRSU0001 proftpd[18003] 192.168.0.111: RequireValidShell
FRSU0001 proftpd[18003] 192.168.0.111: UseFtpUsers
FRSU0001 proftpd[18003] 192.168.0.111: WtmpLog
FRSU0001 proftpd[18003] 192.168.0.111: IdentLookups
FRSU0001 proftpd[18003] 192.168.0.111: Umask
FRSU0001 proftpd[18003] 192.168.0.111: ProFTPD 1.3.4a (maint) (built Thu Mar 8 2012 14:02:45 CET) standalone mode STARTUP
FRSU0001 proftpd[18006] 192.168.0.111 (192.168.0.20[192.168.0.20]): session requested from client in unknown class
FRSU0001 proftpd[18006] 192.168.0.111 (192.168.0.20[192.168.0.20]): connected - local : ::ffff:192.168.0.111:2021
FRSU0001 proftpd[18006] 192.168.0.111 (192.168.0.20[192.168.0.20]): connected - remote : 192.168.0.20:3392
FRSU0001 proftpd[18006] 192.168.0.111 (192.168.0.20[192.168.0.20]): FTP session opened.
FRSU0001 proftpd[18006] 192.168.0.111 (192.168.0.20[192.168.0.20]): dispatching PRE_CMD command 'USER proftpd' to mod_core
FRSU0001 proftpd[18006] 192.168.0.111 (192.168.0.20[192.168.0.20]): dispatching PRE_CMD command 'USER proftpd' to mod_core
FRSU0001 proftpd[18006] 192.168.0.111 (192.168.0.20[192.168.0.20]): dispatching PRE_CMD command 'USER proftpd' to mod_delay
FRSU0001 proftpd[18006] 192.168.0.111 (192.168.0.20[192.168.0.20]): dispatching PRE_CMD command 'USER proftpd' to mod_auth
FRSU0001 proftpd[18006] 192.168.0.111 (192.168.0.20[192.168.0.20]): dispatching CMD command 'USER proftpd' to mod_auth
FRSU0001 proftpd[18006] 192.168.0.111 (192.168.0.20[192.168.0.20]): dispatching POST_CMD command 'USER proftpd' to mod_delay
FRSU0001 proftpd[18006] 192.168.0.111 (192.168.0.20[192.168.0.20]): dispatching LOG_CMD command 'USER proftpd' to mod_log
FRSU0001 proftpd[18006] 192.168.0.111 (192.168.0.20[192.168.0.20]): dispatching PRE_CMD command 'PASS (hidden)' to mod_core
FRSU0001 proftpd[18006] 192.168.0.111 (192.168.0.20[192.168.0.20]): dispatching PRE_CMD command 'PASS (hidden)' to mod_core
FRSU0001 proftpd[18006] 192.168.0.111 (192.168.0.20[192.168.0.20]): dispatching PRE_CMD command 'PASS (hidden)' to mod_delay
FRSU0001 proftpd[18006] 192.168.0.111 (192.168.0.20[192.168.0.20]): dispatching PRE_CMD command 'PASS (hidden)' to mod_auth
FRSU0001 proftpd[18006] 192.168.0.111 (192.168.0.20[192.168.0.20]): dispatching CMD command 'PASS (hidden)' to mod_auth
FRSU0001 proftpd[18006] 192.168.0.111 (192.168.0.20[192.168.0.20]): user 'proftpd' authenticated by mod_auth_file.c
FRSU0001 proftpd[18006] 192.168.0.111 (192.168.0.20[192.168.0.20]):
FRSU0001 proftpd[18006] 192.168.0.111 (192.168.0.20[192.168.0.20]): Config for ProFTPD TEST Installation:
…

Proftpd is working!
Now you just have to configure and secure Proftpd …

How to use iperf for network speed testing – Comment utiliser iperf pour des effectuer des tests de vitesse réseau.

Comment utiliser iperf pour des effectuer des tests réseau

While solving lots of backup issues in my job, I noticed that large number of those was directly related to network issues. Consequently it became a habit to test the network performances of the servers I manage.

Dans mon travail j’ai du résoudre de nombreux problèmes de sauvegarde et j’ai remarqué qu’un grand nombre d’entre eux sont directement liés à des soucis réseau. J’ai donc pris comme habitude de tester les performances réseau des serveurs que j’administre.

Why run network performance tests on your servers:

–          Detect network issue on your servers (wrong Ethernet port configuration, wrong switch configuration …).

–          Detect a global LAN issue (congestion, latency …).

Pourquoi tester les performances réseau de vos serveurs :

–          Pour détecter des problèmes réseau relatifs au serveur directement (configuration du port Ethernet ou du switch …).

–          Pour détecter des problèmes globaux LAN (congestion, latence …).

Why use iperf :

–          Very quick to use: 2 commands and the test is done.

–          Flexible: many options (see below).

–          Iperf exist on both Unix/Linux and Windows platforms.

–          Accurate: iperf doesn’t generate I/O or high CPU load that will distort your test results.

Pourquoi utiliser iperf :

–          Rapide à utiliser : 2 commandes et le test est fait.

–          Flexible : beaucoup d’options.

–          Iperf existe sur plusieurs plateformes.

–          Précis : iperf ne génère pas d’I/O ou charge CPU qui fausseront les résultats des tests.

Handy options:

Options utilies :

-p <port_number> : to change the default port (5001), useful if you are behind a firewall.

-t <seconds> : duration of the test (default is 10s).

-r : run a bidirectional test (up then down).

-d :  run simultaneously a bidirectional test  (up and down at the same time).

You can even launch iperf as a daemon (-D option) on a server so the iperf server will be ready whenever you want to test a client.

 

Options utiles :

-p <port_number> : pour changer le port par défaut (5001), utile si vous êtes derrière un firwall.

-t <seconds> : durée du test (10s par défaut).

-r : lance un test bidirectionnel (montant ensuite descendant).

-d : lance simultanément un test bidirectionnel  (en même temps montant et descendant).

Vous pouvez même lancer iperf en tant que daemon (option –D) sur un serveur. De cette façon le serveur iperf sera prêt à tester des clients à tout moment.

 

Using iperf :

Utiliser iperf :

On one of the servers launch iperf as server:

Sur un des serveurs lancer iperf en mode serveur :

[root@myserver1 root]# iperf -s

------------------------------------------------------------

Server listening on TCP port 5001
TCP window size: 85.3 KByte (default)

 

Then run the test on the other server (in client mode where myserver1 is the name of the server running iperf -s):

Ensuite lancer le test sur l’autre serveur (en mode client où myserver1 est le nom du serveur sur lequel est lancé iperf –s) :

D:\>iperf –c myserver1

------------------------------------------------------------

Client connecting to myserver1, TCP port 5001

TCP window size: 63.0 KByte (default)

------------------------------------------------------------

[1852] local 192.168.1.101 port 36794 connected with 192.168.1.120 port 5001
[ ID] Interval       Transfer     Bandwidth
[1852]  0.0-10.0 sec  1.07 GBytes    921 Mbits/sec

 

Most of the time you will want to run the test with option –r to detect any asymmetric rate issue.

La plus part du temps il faudra lancer le test avec l’option –r pour détecter les problèmes de débit asymétrique :

[root@ myserver3 root] # iperf -c myserver1 -r

------------------------------------------------------------

Server listening on TCP port 5001

TCP window size: 85.3 KByte (default)

------------------------------------------------------------

------------------------------------------------------------

Client connecting to frsu0069, TCP port 5001

TCP window size:   128 KByte (default)

------------------------------------------------------------

[  4] local 192.168.1.102  port 34743 connected with 192.168.1.120 port 5001

[  4]  0.0-10.0 sec    112 MBytes  94.3 Mbits/sec

[  4] local 192.168.1.102  port 5001 connected with 192.168.1.120 port 53073

[  4]  0.0-10.0 sec    112 MBytes  94.1 Mbits/sec

 

You can easily find iperf rpm for you distribution, for Windows and other operating systems here is a link :

Vous pouvez facilement touver le rpm pour votre distribution, pour Windows et les autre systems d’exploitation voice un lien :

iperf download

 

 

Glances: installing and tuning default thresholds on RedHat ES6

Glances is a free (under LGPL license) tool, written by Nicolas HENNION (aka Nicolargo) in Python and using libstatgrab to monitor your system.

I like the concept and it’s very easy to install and to handle.

I used to work a lot with top and sar on linux but now if I have the opportunity to install Glances, I do it.

Conceptually Glances is more like nmon on AIX, or glance on HP-UX (quite the same name, what a coincidence?).

Installation:

Download Glances (1.3.7 on this post) :

Compile glance (you will need gcc) :

# tar ztf glances-1.3.7.tar.gz
# cd glances-1.3.7/
# ./configure
# make
# make install

Then install libstatgrab and pystatgrab librairies.

# rpm -Uvh libstatgrab-0.15-1.el6.rf.x86_64.rpm
# rpm -Uvh pystatgrab-0.5-9.el6.x86_64.rpm

You will not found the 2 rpm on RH ES6 CDs but you can find them on rpm.pbone.net for instance.

Don’t try to install pystatgrab from the sources: it won’t work as it uses pkg-config and pkg-config is not able to locate the libs on RedHat (don’t now why?).

Run Glances:

# glances.py

Glances: installing and tuning

From the screenshot one can see that the server’s main statistics are available on one screen:

Cpu, load, Memory, Network, Disk I/O, Disk space, and process

For the monitoring part you have colors for current thresholds overflow and an history of the last 3 to 10 warning and critical alerts.

For more information see the man page or Nicolargo’s web site (in French):

nicolargo Glances doc

If you want to change the default limits, you will have to edit glances.py

# locate glances.py
/usr/local/bin/glances.py
# vi /usr/local/bin/glances.py

Find glancesLimits class :

class glancesLimits():
"""
Manage the limit OK,CAREFUL,WARNING,CRITICAL for each stats
"""
# The limit list is stored in an hash table:
#  limits_list[STAT] = [ CAREFUL , WARNING , CRITICAL ]
# Exemple:
#  limits_list['STD'] = [ 50, 70 , 90 ]
 
__limits_list = {   #           CAREFUL WARNING CRITICAL
'STD':  [50,    70,     90],
'LOAD': [0.7,   1.0,    5.0]
}

And modify the default limits, for instance:

__limits_list = {   #           CAREFUL WARNING CRITICAL
'STD':  [40,    50,     70],
'LOAD': [0.2,   0.5,    1.0]

Glances: tuning default thresholds

Now you can see that while cpu% user if still lower than 90, the color is now red, meaning CRITICAL and the process who were in CAREFUL state before (<70) are now in WARNING state. Same comment on the load.

Escape command alias “\” – Commande d’échappement d’alias “\”

Escape command alias - Commande d'échappement d'alias

To avoid using an alias instead of the “true” command, the syntax is:

Pour éviter d’utiliser un alias au lieu de la “vraie” commande, la syntaxe est :

\[command]

Example:

# alias
alias la='/bin/ls -laF --color=auto'
alias ll='/bin/ls -laF --color=auto'
alias ls='/bin/ls -laF --color=auto'
alias md='mkdir'
alias rd='rmdir'
alias which='type -P'

For instance, if I try to use “ls -1” in order to list the content of the current directory on 1 column, the result would be overwritten by the alias: “ls -1” would be “ls –laF1” which is the same as “ls –laF”.

Par exemple, si je veux utiliser “ls -1” pour lister le contenu du répertoire courant sur 1 colonne, l’alias prendra le pas : “ls -1” deviendra “ls -laF1” qui est la même chose que “ls -laF”

# ls -1
total 872
drwx------    2 root     root         4096 Oct 10 13:07 ./
drwxr-xr-x    4 root     root         4096 Apr  8  2011 ../
-rw-------    1 root     root        12444 Dec 16  2004 auto.home
-rw-------    1 root     root        12608 Apr  8  2011 group.bygid
-rw-------    1 root     root        12624 Apr  8  2011 group.byname
-rw-------    1 root     root        13027 Apr  8  2011 netgroup
-rw-------    1 root     root        12520 Apr  8  2011 netgroup.byhost
-rw-------    1 root     root        13135 Apr  8  2011 netgroup.byuser
-rw-------    1 root     root        19832 Apr  8  2011 passwd.byname
-rw-------    1 root     root        19541 Apr  8  2011 passwd.byuid
-rw-------    1 root     root       450607 Jan  2  2007 printcap
-rw-------    1 root     root        50425 Feb 27  2007 services.byname
-rw-------    1 root     root       100033 Apr  8  2011 services.byservicename
-rw-------    1 root     root        12702 Apr  8  2011 ypservers

 
If you want the command to react normally you will have to remove the alias:

Si vous voulez que la commande réagisse normalement il faudra supprimer l’alias :

# unalias ls

Or if it’s just a one-time command, use “\”:

Ou si c’est seulement exceptionnel, utilisez “\” :

# \ls -1
auto.home
group.bygid
group.byname
netgroup
netgroup.byhost
netgroup.byuser
passwd.byname
passwd.byuid
printcap
services.byname
services.byservicename
ypservers