From d81797da9a5007fbda18d32393d7765b42d88a65 Mon Sep 17 00:00:00 2001 From: TrebledJ <39648915+TrebledJ@users.noreply.github.com> Date: Fri, 25 Oct 2024 15:49:47 +0800 Subject: [PATCH] content: update linux tips --- .../cheatsheets/2024-04-08-linux-cheatsheet.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/content/posts/programming/cheatsheets/2024-04-08-linux-cheatsheet.md b/content/posts/programming/cheatsheets/2024-04-08-linux-cheatsheet.md index b159e45e1..c7f7b8362 100644 --- a/content/posts/programming/cheatsheets/2024-04-08-linux-cheatsheet.md +++ b/content/posts/programming/cheatsheets/2024-04-08-linux-cheatsheet.md @@ -290,6 +290,7 @@ dirname ~/.bashrc ```sh {data-lang-off .command-line data-prompt="$" data-filter-output="# "} pushd # Push current directory, for easier returning. popd # Return to directory on top of stack. +dirs # List history of dirs. ``` {% alert "success" %} @@ -308,6 +309,12 @@ popd # Return to `~/a/b/c`. `less` is a powerful text viewer (read-only), with capabilities to navigate, search, and filter lines in a file or long text. +Get some help. See all commands: + +```sh {data-lang-off} +h +``` + #### less - Nice Options ```sh {data-lang-off .command-line data-prompt="$" data-filter-output="# "} less file.txt @@ -322,6 +329,8 @@ less -I file.txt less -N file.txt ``` +You can turn on/off these options *inside `less`* by typing `-I`, `-R`, or `-N`. This is useful if you forget to turn them on beforehand (e.g. after curling a web request). + #### less - Navigation ```sh {data-lang-off} j # Line down. @@ -568,6 +577,13 @@ Obligatory. Okay, that's enough vim. +### Useful Things + +Set line numbers. +```sh {data-lang-off} +:set number +``` + ## Hacky Hack Hack ### Generate Bytes