website/content/posts/weird-linux-tricks.md
Anthony Wang bb57d239dd
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
Update all Gitea links
2022-09-05 15:52:10 -05:00

2.4 KiB

title date draft type tags
Weird Linux Tricks 2020-12-23 true post
Random
Linux

Originally posted on my old blog

Impress your friends with one weird trick!

Linux is pretty tricky. Here are a few actually useful tricks.

GDB GUI, or should I say TUI

I've got some mixed feelings about VSCodium, the text editor that I use. It's not bad, but as an Electron app, it predictably has terrible performance issues. For instance, compiling a tiny C++ file can take 10 times as long in VSCodium versus compiling it in the terminal. However, one thing that it does great, with the help of the phenomenal extension Native Debug, is the excellent (although slow) integrated graphical debugging experience, using gdb as the backend. People often decry GUIs for being bloated and not much more useful than the command line, but in this case, the graphical debugger helps me keep track of where I'm at in my code. (Try watching videos in your terminal) Anyways, I've been trying to find a replacement, but no other editor seems to have this nice integration. Then I found out that gdb has its own GUI. Or more accurately, a TUI. Just run gdb with the --tui switch and it should start up with a split screen, with your code at the top and the gdb command line at the bottom. Perfect!

GDB Tui

ip color

ip is one of those commands that always spits out a heap of output, even when I just want something as simple as my IP address. OK, networking is hard, but still, no need to give me several pages of output. Color is here to save the day. Try ip address versus ip -c address and see for yourself!

Go home

Easy. cd. That's it. No aliases needed; should work in basically any shell.

Sparse files

Sparse files are pretty much black magic. Enough said. Basically, only used space is allocated, so a 14TB file containing all zeroes can be represented with no additional storage. You can have all the 14TB files that you ever want!

A 14TB file

Here's a 7 exibyte file, produced using this technique. Now you can brag to four friends about your 7 exibyte hard drive!

A 7EiB file