{"id":2731,"date":"2025-12-21T15:52:26","date_gmt":"2025-12-21T14:52:26","guid":{"rendered":"https:\/\/artheodoc.fr\/?page_id=2731"},"modified":"2025-12-21T15:57:14","modified_gmt":"2025-12-21T14:57:14","slug":"la-commande-less-sous-linux","status":"publish","type":"page","link":"https:\/\/artheodoc.fr\/index.php\/la-commande-less-sous-linux\/","title":{"rendered":"La commande less sous Linux"},"content":{"rendered":"\n<h1 class=\"wp-block-heading\">Tableau d\u00e9taill\u00e9 pour la commande less sous Bash<\/h1>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th><strong>Option<\/strong><\/th><th><strong>Description<\/strong><\/th><th><strong>Exemple d&rsquo;utlisiation<\/strong><\/th><\/tr><\/thead><tbody><tr><td>(sans option)<\/td><td>Ouvre un fichier en mode lecture interactive (navigation avec le clavier).<\/td><td>less fichier.txt<\/td><\/tr><tr><td><code>-N<\/code><\/td><td>Affiche les num\u00e9ros de ligne.<\/td><td>less -N fichier.txt<\/td><\/tr><tr><td><code>-F<\/code><\/td><td>Quitte automatiquement si le contenu tient sur un \u00e9cran.<\/td><td>less -F fichier.txt<\/td><\/tr><tr><td><code>-X<\/code><\/td><td>Laisse le contenu \u00e0 l&rsquo;\u00e9cran apr\u00e8s la sortie (utile pour les terminaux graphiques).<\/td><td>less -X fichier.txt<\/td><\/tr><tr><td><code>-S<\/code><\/td><td>D\u00e9sactive le retour \u00e0 la ligne (utile pour les fichiers avec de longues lignes).<\/td><td>less -S fichier.txt<\/td><\/tr><tr><td><code>-p motif<\/code><\/td><td>Commence \u00e0 la premi\u00e8re occurrence du motif sp\u00e9cifi\u00e9.<\/td><td>less -p \u00ab\u00a0erreur\u00a0\u00bb log.txt<\/td><\/tr><tr><td><code>+\/motif<\/code><\/td><td>Identique \u00e0 -p.<\/td><td>less +\/warning fichier.log<\/td><\/tr><tr><td><code>-m<\/code><\/td><td>Affiche un indicateur de progression en bas de l&rsquo;\u00e9cran.<\/td><td>less -m fichier.txt<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity is-style-wide\"\/>\n\n\n\n<h1 class=\"wp-block-heading\">Touches de navigation dans less<\/h1>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th><strong>Touche<\/strong><\/th><th><strong>Action<\/strong><\/th><\/tr><\/thead><tbody><tr><td><code>Fl\u00e8ches<\/code><\/td><td>D\u00e9placer le curseur (haut\/bas\/gauche\/droite).<\/td><\/tr><tr><td><code>Page Up<\/code> \/ <code>Page Down<\/code><\/td><td>Faire d\u00e9filer par pages.<\/td><\/tr><tr><td><code>Espacement<\/code><\/td><td>Avancer d&rsquo;une page.<\/td><\/tr><tr><td><code>b<\/code><\/td><td>Reculer d&rsquo;une page.<\/td><\/tr><tr><td><code>g<\/code><\/td><td>Aller au d\u00e9but du fichier.<\/td><\/tr><tr><td><code>G<\/code><\/td><td>Aller \u00e0 la fin du fichier.<\/td><\/tr><tr><td><code>\/motif<\/code><\/td><td>Rechercher un motif vers l&rsquo;avant (appuyer sur n pour aller \u00e0 l&rsquo;occurrence suivante, N pour la pr\u00e9c\u00e9dente).<\/td><\/tr><tr><td><code>?motif<\/code><\/td><td>Rechercher un motif vers l&rsquo;arri\u00e8re.<\/td><\/tr><tr><td><code>n<\/code><\/td><td>Aller \u00e0 l&rsquo;occurrence suivante du motif recherch\u00e9.<\/td><\/tr><tr><td><code>N<\/code><\/td><td>Aller \u00e0 l&rsquo;occurrence pr\u00e9c\u00e9dente du motif recherch\u00e9.<\/td><\/tr><tr><td><code>q<\/code><\/td><td>Quitter less.<\/td><\/tr><tr><td><code>h<\/code><\/td><td>Afficher l&rsquo;aide (liste des commandes disponibles).<\/td><\/tr><tr><td><code>v<\/code><\/td><td>Ouvrir le fichier dans l&rsquo;\u00e9diteur d\u00e9fini par la variable EDITOR (par d\u00e9faut, vi).<\/td><\/tr><tr><td><code>F<\/code><\/td><td>Suivre la fin du fichier (utile pour les logs en temps r\u00e9el, comme <strong>tail -f<\/strong>). Appuyer sur <strong>Ctrl<\/strong>+<strong>C<\/strong> pour arr\u00eater.<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity is-style-wide\"\/>\n\n\n\n<h1 class=\"wp-block-heading\">Cas d&rsquo;usage courants<\/h1>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Lire un fichier volumineux&nbsp;: less est plus efficace que <a href=\"https:\/\/artheodoc.fr\/index.php\/la-commande-cat-sous-linux\/\" data-type=\"page\" data-id=\"2726\" target=\"_blank\" rel=\"noreferrer noopener\">cat<\/a> pour les gros fichiers, car il ne charge pas tout le contenu en m\u00e9moire.<\/li>\n\n\n\n<li>Rechercher dans un fichier&nbsp;: Utilisez \/motif pour trouver rapidement une cha\u00eene de caract\u00e8res.<\/li>\n\n\n\n<li>Visualiser des logs&nbsp;: Combinez avec <a href=\"https:\/\/artheodoc.fr\/index.php\/la-commande-grep-sous-linux\/\" data-type=\"page\" data-id=\"2445\" target=\"_blank\" rel=\"noreferrer noopener\">grep<\/a> pour filtrer des lignes sp\u00e9cifiques <\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-preformatted\">grep \"erreur\" fichier.log | less<\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity is-style-wide\"\/>\n\n\n\n<p>Sources&nbsp;: Le Chat Mistral<\/p>\n\n\n\n<p><a href=\"https:\/\/chat.mistral.ai\/chat\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/chat.mistral.ai\/chat<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Tableau d\u00e9taill\u00e9 pour la commande less sous Bash Option Description Exemple d&rsquo;utlisiation (sans option) Ouvre un fichier en mode lecture interactive (navigation avec le clavier). less fichier.txt -N Affiche les num\u00e9ros de ligne. less -N fichier.txt -F Quitte automatiquement si le contenu tient sur un \u00e9cran. less -F fichier.txt -X Laisse le contenu \u00e0 l&rsquo;\u00e9cran [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"class_list":["post-2731","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/artheodoc.fr\/index.php\/wp-json\/wp\/v2\/pages\/2731","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/artheodoc.fr\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/artheodoc.fr\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/artheodoc.fr\/index.php\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/artheodoc.fr\/index.php\/wp-json\/wp\/v2\/comments?post=2731"}],"version-history":[{"count":3,"href":"https:\/\/artheodoc.fr\/index.php\/wp-json\/wp\/v2\/pages\/2731\/revisions"}],"predecessor-version":[{"id":2736,"href":"https:\/\/artheodoc.fr\/index.php\/wp-json\/wp\/v2\/pages\/2731\/revisions\/2736"}],"wp:attachment":[{"href":"https:\/\/artheodoc.fr\/index.php\/wp-json\/wp\/v2\/media?parent=2731"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}