I wish I could find an actual course on using the #Linux terminal. Yes yes, rtfm. "Read this pile of documentation" is not the learning method that actually works for me. That is a massive struggle. I need more of a "Our goal today is to accomplish X" and learning all the commands and stuff to get to that goal. Ya know, kinda how a woodworking class might be building a bird house this week, and they learn the tools that result in a bird house.
@greycat I knew that search term. I was hoping there might be something interactive. Info just sitting in front of me, and I have to provide the structure, doesn't mesh so well with executive dysfunction and focus struggles. That's why best cli learning moments are when something is broken and my only options are learn it or no longer have the broken thing.
@hellomiakoda@pdx.social your best bet is probably going to be books or videos on using the "command line" or "CLI". they usually start with the basics and build from there.
@norobledos Not actually sure where my skill level is measured. I can do quite a bit, but not knowing how far away "expert" is, it's kinda hard to access where I'm at.
cp, mv, ls apt, pacman, yay, zypper, cat, tail, head - all stuff I'm pretty comfy doing. Tmux - a frequently used tool, but I'm still having to look up commands every time I go beyond detach, next, and previous. find, grep - I've touch them. I know what their for. Probably using like 1% of what they can do.
@norobledos I want to go from comfy advanced user who can fix stuff but often needs a web browser to look it up, to expert who can do most anything with little more than a glance at my notes.
@TimePencil Scrolling the page, it looks like it's a lot of stuff I already know, but likely also covers the holes I want to sure up in the basics so I can move further. Signing up!
"What You’ll Learn: This course explores the various tools and techniques commonly used by Linux system administrators and end users to achieve their day-to-day work in a Linux environment. You will gain a good working knowledge of Linux and learn how to navigate through major Linux distributions, system configurations and graphical interface of Linux, basic command line operations, common applications of Linux, and more."
@ramin_hal9001 Kinda iffy on that example. I kinda understand it, kinda. echo makes text. By itself, it'd go to stdout. * is a wildcard, but don't understand what it'd do with echo. grep - Kinda like ctrl + F in a web browser, but I suspect my understanding of it is basic AF. \.txt$ I know it's looking for text files, but no idea why that means it's looking for text files. > text-files.csv is making a comma seperated list of the output.
@hellomiakoda I have an article on my blog about how to do batch file renaming. If you have a suggestion for me of a specific task (or a class of related tasks) you would like to learn, I’d be happy to write a blog article on how to do it.
To “learn the terminal” means to study the Bourne Shell programming language, so you learn it the same way you learn any other programming language. This comes down to understanding how the lexer and parser works, then the semantics for things like how to assign and use variables, how to construct procedures, and how to do conditional branch execution. Then you learn the “standard libraries,” which for the Linux terminal means learning how to use commands such as find, grep, sed, awk, and so on.
Do you understand how the shell does lexing, that is, breaking up a command into tokens? For example, the command:
echo *|grep '\.txt$'>text-files.csv 2>&1&
Is broken down into the following tokens:
echo
*
|
grep
'.txt$'
>
text-files.csv
2>
&1
&
If you already know that much, you are ready to start learning about conditionals and control flow.
@ramin_hal9001 2>&1 makes it also go to stdout, but I have absolutely no idea what that combo of symbols actually means, I just know I've seen that specific combo before to make it do both. The last &, if I remember right, makes it release control of the terminal
@ramin_hal9001 "Regular expression" - Regex! I first saw that way back when I was figuring out.. tasker, I think it's called, on Android. I was unsuccessful in understanding it much then, but I've got a better grasp of it now... I think/assume.
Glob - didn't know the word for it, but that one I know.
file* would match names beginning with file, so files, filed, filepile, but not thatfile, yeah?
@hellomiakoda@hellomiakoda thanks, I have a pretty good idea of where you should start learning, but I’ll have to search around a bit for some resources you can use.
Without going into too much detail, let me just breifly explain the example I wrote above. First of all, it is basically a useless command so I would not recommend using it, I just wanted an example that would show how lexing works.
Yes the echo will take it’s arguments and print them. The * character is a special token called a “glob pattern” that tells the shell to substitute that token with whatever the “glob” pattern matches in the current directory, lists of files being separated by spaces. So that will simply lists all of the files that match * (basically all files that do not start with dot) in the current directory, then creates a huge string which each file name separated by spaces, then dumps that string to it’s output pipe.
You are right about the pipe.
The 2>&1 command is called a “redirect,” in this example it means to join the STDERR stream, which has integer code 2, to the STDOUT stream, which has integer code 1. This would make it so that error messages are also pushed to the input of the next process in the pipe, which usually you would not want to do unless you want a log of the result of the left side of the pipe. The 0> syntax indicates the STDIN stream (input stream, taken from the left of the pipeline) which can also be written as just <, the 1> syntax indicates STDOUT which can also be written as just >. You can also specify a file instead of a stream integer ID, so >text.csv says the STDOUT stream should write to a file rather than some other stream.
The grep command searches it’s input stream for a “regular expression”, this is a very different kind of string pattern from the “glob expressions” (for example *.txt) that the shell uses. Regular expressions are more powerful than glob expressions. You can search Wikipedia for these terms, the articles there will give you a good sense of how each are used. Grep is also a line-based protocol, so it breaks it’s input into lines and only outputs the line if it matches the “regular expression”.
The “grep” works on lines of text, and since echo creates only one line of text containing all the file names, grep will either print everything or nothing depending on whether the final file matched ends in “.txt“.