this post was submitted on 25 Feb 2024
442 points (98.7% liked)
Linux
48372 readers
1837 users here now
From Wikipedia, the free encyclopedia
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word "Linux" in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.
Rules
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.
- No misinformation
- No NSFW content
- No hate speech, bigotry, etc
Related Communities
Community icon by Alpár-Etele Méder, licensed under CC BY 3.0
founded 5 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
Alt + .
inserts the last argument from the last command run into the current line. I find it helpful all the time.less
can be invoked directly, without having to be piped fromcat
:less
is mostly equivalent tocat | less
I have considered making an alias/function that automatically determines if the file is longer than the terminal, using something like
wc -l
andstty -a | grep -oP "rows \d"
and then either usescat
orless
depending on that... but I already use sharkdp'sbat
, which has that baked in as well as many other conveniencesDon't forget
tail -f
which is kind of likewatch tail
If you're going to have
du
, I would also have a section fordf
, I use the latter more often (but probably because I have like 5 mounts for my OS). Using them in combination is basically what all the gui disk usage analyzers do; something likedf -h
"oh,/var
's almost full" (as previously mentioned, I have different folders on different partitions), thendu -ah /var
and so on to find problem areasThe "installing from source" section works maybe 50% of the time. It assumes a
configure
script, which isn't always the case. I've had a lot of source that comes bundled the way a.deb
does: basically a compressed filesystem that assumes the$CWD
is/
(basically, if you uncompressed it in/
, all the files would go where they needed to be). Sometimes they use language-specific build systems, so you might need go and rust and... Maybe it's best to just keep it your way and look up the rest, but do keep in mind the thing I said about compressed filesystemsfind
is great if you want to reindex everything from square 0; or if you only need to do small directory/tree. If you have the extra space to spare, installlocate
: it indexes the files beforehand (as a cron job) and yields results more quickly for searches that span entire filesystems; the only downside is that you have to manually reindex (sudo updatedb
) to locate files installed the same dayIn the
Extracting, Sorting, and Filtering Data
section, you might consider adding insort -u
anduniq
which fill their own (overlapping) niches.sed
andawk
may be a bit more than beginner, but they are endlessly helpful.tr
can be a useful shorthand for whencut
andsed
don't quitecut
it, but you don't want to build a full in-lineawk
script.Finally:
Should read "Output and errors from are redirected to " because the single
>
overwrites the existing file, as opposed to>>
which, as you noted, appends to the end of the file