this post was submitted on 16 Dec 2025
165 points (98.2% liked)

Linux

63252 readers
456 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

Related Communities

Community icon by Alpár-Etele Méder, licensed under CC BY 3.0

founded 6 years ago
MODERATORS
 

I've been setting up a new Proxmox server and messing around with VMs, and wanted to know what kind of useful commands I'm missing out on. Bonus points for a little explainer.

Journalctl | grep -C 10 'foo' was useful for me when I needed to troubleshoot some fstab mount fuckery on boot. It pipes Journalctl (boot logs) into grep to find 'foo', and prints 10 lines before and after each instance of 'foo'.

(page 3) 33 comments
sorted by: hot top controversial new old
[–] fhein@lemmy.world 1 points 2 months ago

These aliases for zsh I use all the time. It's part of the prezto configuration framework.

setopt AUTO_CD              # Auto changes to a directory without typing cd.
setopt AUTO_PUSHD           # Push the old directory onto the stack on cd.
setopt PUSHD_IGNORE_DUPS    # Do not store duplicates in the stack.
setopt PUSHD_SILENT         # Do not print the directory stack after pushd or popd.
setopt PUSHD_TO_HOME        # Push to home directory when no argument is given.

alias d='dirs -v'
for index ({1..9}) alias "$index"="cd +${index}"; unset index

Type d and enter to list all the directories you've recently been in, then type the number at the start of the line followed by enter to immediately cd there.

Not sure if latest bash can do it the same thing, but some years ago I wrote a script to implement it there too. IIRC it might've been the automatic removal of duplicates in dir history that was missing.

[–] furrowsofar@beehaw.org 1 points 2 months ago* (last edited 2 months ago)

Various uses of "find" in particular. "xargs" sometimes too. The capabilities of "bash" in general including scripting and the whole redirection, piping, and multiprocessing capabilities in particular.

[–] corsicanguppy@lemmy.ca 1 points 2 months ago

Journalctl | grep -C 10 'foo' was useful for me when I needed to troubleshoot some fstab mount fuckery on boot.

Ha! Remember back when there was no fstab fuckery? Good times. But you have a massive init blob slowly eating other services and replacing them with shitty replicants like this embarrassment (ohai root NFS) and all of us Unix people are chuckling in our reduced-fuckery 'hell'.

[–] utopiah@lemmy.ml 1 points 2 months ago
fabien@debian2080ti:~$ history  | sed 's/ ..... //' | sort | uniq -c | sort -n | tail
# with parameters
     13 cd Prototypes/
     14 adb disconnect; cd ~/Downloads/Shows/ ; adb connect videoprojector ;
     14 cd ..
     21 s # alias s='ssh shell -t "screen -raAD"'
     36 node .
     36 ./todo 
     42 vi index.js 
     42 vi todo # which I use as metadata or starting script in ~/Prototypes
     44 ls
    105 lr # alias lr="ls -lrth"
fabien@debian2080ti:~$ history  | sed 's/ ..... //' | sed 's/ .*//' | sort | uniq -c | sort -n | tail
# without parameters
     35 rm
     36 node
     36 ./todo
     39 git
     39 mv
     70 ls
     71 adb
     96 cd
    110 lr
    118 vi
[–] ekZepp@lemmy.world 1 points 2 months ago

lower the monitor black for my tired eyes

xrandr --output eDP-1 --gamma .7:.7:.7

[–] GaryGhost@lemmy.world 1 points 2 months ago (3 children)

ps -ef | grep <process_name

Kill -9 proces id

I googled that -15 is better, I forgot what -9 even did, been using it for years.

load more comments (3 replies)
[–] Penguincoder@beehaw.org 1 points 2 months ago* (last edited 2 months ago)

A couple I use (concept of not exact), that I haven't seen in the thread yet:

Using grep as diff: grep -Fxnvf orig.file copy.file

Using xargs -

xargs reads items from the standard input, delimited by blanks (which can be protected with double or single quotes or a backslash) or newlines, and executes the command (default is /bin/echo) one or more times with any initial-arguments followed by items read from standard input.

EG: $ find ~/Pictures -name "*.png" -type f -print0 | xargs -0 tar -cvzf images.tar.gz

[–] Twakyr@feddit.org 1 points 2 months ago

I like emerge --moo, just to See how larry is doing. Only gentoo tho :(

[–] eli@lemmy.world 1 points 2 months ago* (last edited 2 months ago)

There are a lot of great commands in here, so here are my favorites that I haven't seen yet:

  • crontab -e
  • && and || operators
  • ">" and >> chevrons and input/output redirection
  • for loops, while/if/then/else
  • Basic scripts
  • Stdin vs stdout vs /dev/null

Need to push a file out to a couple dozen workstations and then install it?

for i in $(cat /tmp/wks.txt); do echo $i; rsync -azvP /tmp/file $i:/opt/dir/; ssh -qo Connect timeout=5 $i "touch /dev/pee/pee"; done

Or script it using if else statements where you pull info from remote machines to see if an update is needed and then push the update if it's out of date. And if it's in a script file then you don't have search through days of old history commands to find that one function.

Or just throw that script into crontab and automate it entirely.

[–] Geodes_n_Gems@lemmy.ml 1 points 2 months ago

Running Wine is the command I've used the most probs, you can tell I haven't touched the thing in months.

load more comments
view more: ‹ prev next ›