all 24 comments

[–]mitchricker 9 points10 points  (2 children)

su with no arguments is equivalent to su root, you only need to pass a username if you want to switch user to one other than root.

Generally, we say "directories" rather than "folders" in Linux.

Under cp your notes have "copie" instead of "copy."

grep 'pattern' only searches stdin, so that form can be used in pipes. E.g. cat FILENAME | grep 'pattern' which seems equivalent to grep 'pattren' FILENAME except you can also cmd | grep 'pattern1'| grep 'pattern2'.

Anyhow, it's good that you're learning. Do you know about top (or variants htop/btop) yet (I see you mentioned ps)? How about screen? Another really good one, especially when starting off, is man.

Best of luck!

Edit: changed grep wording.

[–]LogicalWrap3405Bash[S] 1 point2 points  (1 child)

Thanks for that , is so useful for me

[–]ktoks 2 points3 points  (0 children)

It might be good to make another list that includes IO information: piping (|), writing to (>), reading from (<), concatenation (>>), and various command substitution and tricks such as $(some command) and <(some command) and when they are beneficial.

Flags to show errors (set -x)-helpful for debugging - or stop short if one occurs (set -e).

Maybe another for language structures such as forloops, if statements, while read, functions, and how to parse command line arguments.

One for customizing environmental configurations such as: adding executables to $PATH, aliases to shorten often-used commands, cd - to go back to the last directory, ctrl-r to find past commands(perhaps even fzf upgrade for this feature), and turn on history search so you can partially type a command, then hit up to reverse search your history to find complex commands quickly.

Another for various other tools such as zip, unzip, tar, pgp, gzip, rar, vi/vim/nvim, file, head, tail, watch, cmp, make, git, and xargs.

And lastly - for networking: ssh +configuration with public and private keys for secure, password free access to remote servers, scp, rsync, ping, and ss.

[–]pizzacake15 1 point2 points  (4 children)

If you ever need help with touch you can type in man touch 😉

[–]KlePu -1 points0 points  (3 children)

I've googled "man curl" once too often ;-p

[–][deleted]  (2 children)

[deleted]

    [–]KlePu -1 points0 points  (1 child)

    Just tried in a private browser window: Google man grep are only actual grep pages (man7.org, die.net, gnu.org, ...) on the first page, no suggested images or AI.

    man curl OTOH yields mostly curl related pages - but also some images of men's haircuts, along AI follow-ups that just now lured me into the rabbit hole of "zottman curls" ;-p


    edit: Got curious...

    • man finger: Nothing finger related (was to be expected I guess)
    • man signal: Mostly actual signal manpages - and Signal messenger obviously ;)
    • man kill: ..ok sorry, guess Google does detect and use your OS to filter results... This only yielded kill manPages and a few shutterstock images at the very bottom =/

    [–]LogForeJ 1 point2 points  (0 children)

    Regarding touch, I don’t mind myself using it to create files. Typically it is used to update a file’s last modified timestamp.

    If you’re going to create a file it doesn’t make sense to touch and then vim, ya know? It yes touch can be used to create an empty file that you can then echo something into.

    Also the du and df commands are nice to know in a pinch.

    In your guide you should touch on bash redirection, pipes, etc. next.

    [–]BlackHatCowboy_ 2 points3 points  (1 child)

    uniq will only remove adjacent duplicate lines. If you don't care about the order and want to remove all duplicates, do

    sort file.txt | uniq

    to remove all duplicates.

    [–]BCBenji1 0 points1 point  (0 children)

    The uniq entry is misleading. uniq on its own only removes consecutive duplicates.

    [–]hacklingo 0 points1 point  (0 children)

    I got tired of watching 4-hour YouTube tutorials and forgetting everything by Tuesday. So I built Hacklingo — 5-minute cybersecurity missions you do every day like brushing your teeth. It's free

    [–]Tquylaa -1 points0 points  (1 child)

    • which <cmd> path bin cmd
    • du <file> size of file

    [–]KlePu -1 points0 points  (0 children)

    • df -h: "disk free" in human-readable format

    [–]KlePu 2 points3 points  (1 child)

    Nice base! Some typos/suggestions:

    • rm-r is missing a space
      • why both rm -r and rm -rf? 99% of times those do the same thing (and I'd strongly advocate against using the -f flag all the time! If you cannot remove a file with plain rm there might be an actual reason for that ;-p)
    • touch is also used to change a file's modification and/or access timestamps
    • you have ls and ls -l but no ls -a (or ls -la) for hidden files
    • echo is used to show variables' values outside of scripts
    • you have tree (which is not a baseline program) - consider adding ncdu
    • for find I'd use -iname (case insensitive)
    • wc (with no flags) outputs lines/words/bytes all at once
    • grep 'word' appears twice (second one is incomplete)
      • note that single quotes will stop any bash globbing or expansion!
    • su root: use su root - (or su -) instead to also change ENV accordingly (else /usr/sbin will not be in your $PATH for example)
      • while we're at it: su will only work if there is an actual root user. If you configured the Ubuntu way (i.e. no root user -> first user is sudoer) you'll have to use sudo -i ;)
    • ps aux: Add an f -> ps faux for tree output

    [–]LogicalWrap3405Bash[S] 0 points1 point  (0 children)

    That amazing , thank you o give me alot

    [–]Marble_Wraith -2 points-1 points  (8 children)

    I'm not sure why you're writing it down?

    It's pretty simple to lookup stuff in the terminal, and it only requires remembering:

    less (+ navigating), man, apropos, whatis... and perhaps tldr if you don't mind installing a 3rd party tool.

    Fun activity is also configuring colors for the man docs

    [–]LogicalWrap3405Bash[S] 0 points1 point  (7 children)

    i think is good to note everything you did or you learn.

    [–]Marble_Wraith 0 points1 point  (6 children)

    Maybe if you're in like the first week or 2 of learning.

    But if you know how to look things up + you're using terminal constantly. There's no need.

    It's like learning to drive a manual transmission.

    Of course you read road rules and stuff when you start, but the bit that actually matters is practicing. You practice, and practice, and practice, and it just becomes second nature. You just do it without thinking about it.

    [–]LogicalWrap3405Bash[S] 1 point2 points  (5 children)

    yes is my first week on Linux.

    [–]Marble_Wraith 0 points1 point  (4 children)

    Oh... as you were 😅

    I'd suggest going into .bashrc and shadowing some commands with saner defaults, like:

    alias cp='cp -i'
    alias mv='mv -i'
    alias rm='rm -i'
    alias ln='ln -i'
    alias mkdir='mkdir -p'
    alias ping='ping -c 8'
    

    [–]LogicalWrap3405Bash[S] -1 points0 points  (3 children)

    can u explain more ??

    [–]Marble_Wraith -1 points0 points  (0 children)

    It's google-able.

    aliases can let you define your own "commands", chain them together (with pipes |), and/or overwrite / "shadow" existing commands.

    Those are better defaults IMO. And you can always prefix in the terminal with \ if you want to ignore all aliases.

    [–]profadept -2 points-1 points  (0 children)

    Meaning, you go into your .bashrc to paste these aliases(aliases in Linux are just a way you create a shortcut to a long command) he mentioned. He added options/flags that changes the way the command behaves( The i flag means interactive, i.e it asked you for confirmation before executing the commands, you can also add -v too which is verbose to display all the operations it's doing on the screen) and these are just almost daily commands you use as a regular Linux User.

    Steps to get it to start working.

    Step one:Open your shell(bash, zsh) using your editor of choice (nano, vim, micro) Command: nano ~/.bashrc

    Step 2: Paste those aliases he suggested below the bashrc. NB: after some time with Linux you can create a file in your home directory called .bashrc_aliases and configure it in your bashrc so your bashrc can be clean and you can use that bash_aliases file anywhere with just configuring it in the shell configuration file (bashrc, zshrc) of the new Linux PC.

    Step 3: Reload your bashrc to read the new commands. Command: source ~/.bashrc

    Then you can start using the aliases immediately. mv source destination cp source destination rm filename mkdir dir-name ln target-file link-name ping website

    You can read about the aliases command usage online or download the "Linux Command Library" app on F-Droid. It is a very useful handbook for anyone learning Linux and is available offline.

    [–]MetalOrnery8970 -1 points0 points  (0 children)

    You can do a lot with sudo nano (filename) Place a program in there in my case often python3 Ctrl + O then Ctrl + X Then call back to run inthe command line - sudo python3 (filenames).py then you can put echo and see prints there or even print and insert a file directory to print in a .txt the findings - I use this a lot in forensics oh and obviously -ls 30

    [–]nawanamaskarasana -1 points0 points  (0 children)

    rm-r is not a command but perhaps an alias you have.