How can I get better at the CLI?

https://feddit.nl/post/191822

How can I get better at the CLI? - feddit.nl

I have some basic experience but I wanna be proficient and have a cli based workflow; I’m currently on Arch with GNOME

what do you mean with "CLI based workflow"? If it's about not using the gnome utilities like wifi, just check the arch wiki, pretty much everything is explained in there
Just use the programs in the terminal more and more. You're literally just running programs with some arguments to make them do exactly what you want. Even scripts are just a list of commands to run.
Start using it more frequently and favor it over GUI apps. For instance, use cd and ls over the file manager. Launch applications I using the command line. Figure out ways to do in the CLI what you used to do using GUI. Over time you should get more comfortable with the environment.
I do most things on the command-line and for me, the trick is not having a lot of scripts laying around. If it's a common action I do a lot (like running thr local test bed), I rely on shell history. Beyond that I just start chaining stuff together on the fly. It forces me to keep knowledge of the utilities fresh, and also keeps me from having a ~/bin folder full of outdates crap that almost does what I want.
Create a cheat sheet with useful commands so you don’t have to look them up online every time you need them.
Get use to navigating the file system. Know where you are, where you want to go and how to get there. After that, start following guides on installing things manually just for fun. I can’t tell you how many times I’ve installed Arch Linux in a VM from scratch for fun. Lol. The Arch Wiki is your friend and can be used even if you stop using arch for certain things.
Unplug your mouse. Seriously. Do it. It might sound like the "kicking and screaming" method but you'll learn to rely on your keyboard even for GUI tools and you'll vastly improve how fast you navigate your computer. You should find yourself more and more in the terminal, obviously, but you may learn also some nice tricks with everything else.
The trick is to xdotool the cursor around the screen and to simulate keystrokes.

Focus maybe on some CLI tools, like text editor. I use Vim, it was pain to learn but been worth it, since you don't have to leave the keyboard for anything. Once you learn the layout you can use it in other IDEs that also, many have plugins or built in support for Vim layout (JetBrains IDEs do) so I can use the same key map in desktop apps to do C# and C++, etc..
Also use Vim Mode that mode in the https://obsidian.md/. Which is great since you can also use Vim in the CLI to edit the Markdown Files.
Good Vim Cheat Sheet, bit confusing but as you get use to VIM it makes more sense.
http://materials.ucsd.edu/doc/vim_cheat_sheet_for_programmers_screen.pdf

Also this book is pretty handy, the 3rd edition dropped GUI apps and focuses 100% on CLI.
https://linuxpocketguide.com/
Handy if you have a Steam Deck also.

Obsidian - Sharpen your thinking

The free and flexible app for your private thoughts.

Obsidian

My biggest suggestion is to use cli tools, read man pages, start with man man, install info pages and use a tool like tldr.

Like everything else one wants to learn, the best ist to practice and learn through finding better solution for own made failures.

@LynnTheChaoticWitch you could try some games to help you learn if you like gamified methods.

https://devopschops.com/blog/games-for-learning-linux/

5 Games for Learning Linux and the Command Line · DevOpsChops Diaries

Just... Use it more, really the only way to get better at something is to do it more.

I recommend replacing GUI apps that you use one by one with CLI apps, I started by changing my file manager to ranger. Don’t rush or you may get overwhelmed and don’t interrupt your workflow too much. Next I started using media players, video editors, and even steamcmd to launch games, try to find a replacement for GUI apps searching online. This list is a good place to start;

https://github.com/agarrharr/awesome-cli-apps

GitHub - agarrharr/awesome-cli-apps: 🖥 📊 🕹 🛠 A curated list of command line apps

🖥 📊 🕹 🛠 A curated list of command line apps. Contribute to agarrharr/awesome-cli-apps development by creating an account on GitHub.

GitHub

Lots of people are suggesting using TUI applications.

While I don't disagree that will make you more comfortable spending time in the terminal, you're not really getting better at the command line (CLI).

I recommend you learn the basics of how the shell works. This is a good resource: https://effective-shell.com/

Linuxcommand.org is a great start

Learn to like not having to use your mouse. Only use your mouse as a last resort. One strength of CLI is almost never having to move your hands off of the homerow. Fuzzy finding is your friend.

For example:

  • Instead of using a desktop app like GNOME, where you click on stuff to open them on a visual desktop -> Use a window manager like i3. In i3 configs, set a keyboard shortcut to fuzzy find your installed applications and open them. Now, your process for opening Firefox goes from clicking on a desktop icon or scrolling through menus, to pressing a keyboard shortcut and typing in the first few characters of Firefox and pressing enter. Desktops are bloat, you can get all of the functionality of a desktop with just the i3 rust status bar extension and CLI.
  • Instead of typing out and remembering long CLI commands with a bunch of flags, use fzf to fuzzy find through your bash history. Fzf uses Ctrl-R for this, and it makes CLI interfaces much faster to navigate once you've already used those commands. It also makes searching files and navigating directories in CLI faster.
  • Mac and Windows lack keyboard shortcuts to fully manage the layout of things on your screen. I know they have some shortcuts, but they can't do everything without a mouse. Once again, I recommend a tiling window manager like i3 for moving tiles around, resizing, etc, all from the keyboard.
  • Learn vim or similar text editors which not only use the keyboard for typing characters, but also for navigating and editing text. Instead of moving your mouse to the end character of a long word you want to delete and hitting the backspace key 20 times -> In vim, type '/' and the first few characters of the word, press enter, and type 'dw' to delete the entire word. Vim mode is also available in bash and a bunch of extensions for other apps, you just have to configure them.
The rest of the comments are very good, but I'd recommend trying to administer a server and only connect to it via ssh. It will force you to learn cli as there will be no gui
Switch to Gentoo. Either your command-line abilities will improve, or you will run screaming into the night before you manage to get X (or Wayland) up and running. 😜

First thing I'd do is ditch the GUI file manager: get comfortable with cd, ls, mv, rm, etc.

After that, maybe start with basic text manipulation, like grep, awk, sort, uniq, etc. This ties in nicely with IO redirection, which is essential for a "CLI based workflow." Get comfortable with pipes and file redirection, it's extremely powerful!

Writing shell scripts is another super useful exercise: any time you find yourself running the same set of commands multiple times, think about making it a shell script. You may end up with some really useful little custom tools that way.

I recommend making a project for yourself, maybe start out with a trivial script, and move on to something with control structures (e.g. if this then that) and variables, and tests, e.g. VALUE=8; [[ 8 -eq $VALUE ]] && echo 'they are equal'.

Start to use command line tools like mutt, links and so on. Okay, maybe not links, but mutt is still the best MUA around.

And whenever you are asked to get some data out of an excel sheet, export it to csv and use sed, awk, grep, wc, cut, uniq, sort, head, tail and stuff.

No, stuff is not a command afaik 😁

Someone already mentioned The art of command-line. It’s a start.

And just use it… you’ll get better at it with time and practice.

Also, make sure your use of the CLI enhances your workflow, or it won’t work.

GitHub - jlevy/the-art-of-command-line: Master the command line, in one page

Master the command line, in one page. Contribute to jlevy/the-art-of-command-line development by creating an account on GitHub.

GitHub