this post was submitted on 24 Nov 2023
43 points (100.0% liked)

Linux

1259 readers
45 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 5 years ago
MODERATORS
top 10 comments
sorted by: hot top controversial new old
[–] executivechimp@discuss.tchncs.de 8 points 1 year ago (4 children)

Good article. Rather than aliasing `cd ../.." etc. I've got this function in my setup:

up () {
	local x='' 
	for i in $(seq ${1:-1})
	do
		x="$x../" 
	done
	cd $x
}

This lets me do up 4 to go up 4 directories.

[–] Astaroth@lemm.ee 2 points 1 year ago

I use Fish and have keybinds for previous and next directory, 99% of the time when going up in a directory it's to (one of) the previous directory/ies I was in

[–] PlexSheep@feddit.de 1 points 1 year ago

What I use to automatically extend stuff like ls .... to ls ../../../..

function expand-dots() {
    local MATCH
    if [[ $LBUFFER =~ '(^| )\.\.\.+' ]]; then
        LBUFFER=$LBUFFER:fs%\.\.\.%../..%
    fi
}

function expand-dots-then-expand-or-complete() {
    zle expand-dots
    zle expand-or-complete
}

function expand-dots-then-accept-line() {
    zle expand-dots
    zle accept-line
}

zle -N expand-dots
zle -N expand-dots-then-expand-or-complete
zle -N expand-dots-then-accept-line
bindkey '^I' expand-dots-then-expand-or-complete
bindkey '^M' expand-dots-then-accept-line

(for zsh)

[–] Specialpatrol@feddit.uk 1 points 1 year ago
[–] beeng@discuss.tchncs.de 1 points 1 year ago (1 children)

Look into zoxide.

z direc

Will take you to the most used directory starting with "direc" eg "/home/me/random/directory"

[–] executivechimp@discuss.tchncs.de 2 points 1 year ago (1 children)

I've tried things like that before but never got on with them. I found when I had many projects with similar directory structures it was easy to end up in the wrong place and took more thought to get to the right place than just cding

[–] beeng@discuss.tchncs.de 1 points 1 year ago* (last edited 1 year ago)

The dir's are the same names or similar? A few extra key strokes to get the fullname should be easier than cd'ing back and forth.

There's also z foo "space" "tab" as per docs to get interactive list for matches.

But, just a suggestion!

[–] QuazarOmega@lemy.lol 3 points 1 year ago

Great stuff! Didn't know about lf

[–] hallettj 2 points 1 year ago

I use that r function regularly to go to the git project root. But I call it gtop. I mostly use that and zoxide to get around.

Thanks for these tips.