That seems like a inordinate amount of work to just not see dot files. But then again, haven't we all spent copious amounts of time at some point, fixing something that bothers literally no one else? The symptoms of a true nerd.
Sometimes I think the Windows "hidden" attribute would have been a good idea to have in Linux as well, in addition to dotfiles. This way we could mark any file we want to be hidden, without changing its filename and therefore path. If someone don't like that, then one could just ignore the hidden attribute and show all files.
That’s not a bad idea. In fact, prefixing a file name with a dot was not supposed to hide it. That was a bug that never got fixed, and now it’s considered intended behavior.
True. For me one example is MX Linux. It has a good set of right-click commands such as right-clicking on a file using the option to check the checksum. It bothered me so much that CRC32/SFV wasn't included---only MD5, SHA1, SHA256, and SHA512. I went out of my way to edit some system files to include CRC32 in the same place where the other file checksums are available and felt so guuuuud after I have it working perfectly the way I want it. Why include CRC32? I dunno... I'm just so familiar using that file checksum during my IRC anime fserver days... it just stuck on me ya know? 🤪
This is over-complicated. The way I do this is to make a /data directory, then move and symlink my home directories accordingly to this directory (also some config files get moved here). Then I do not have to change all those system configs you are talking about, as the way Linux sees things, everything is still where it belongs. Also, to backup my system, all I need to grab is /data. If it is not in /data, then it can be re-installed and I do not need to worry about it.
Was about to post the same thing. Any critical dot files/directories back up to /data. Examples. .ssh .gpg .bashrc etc .user-dirs.dirs I do edit this, but only once
Me too, and the folder is synced to my NAS so that it makes it very easy to reinstall the OS if needed. Issue is remembering which folders are important to create symlinks when first installed 😂
After reading your comment, I ended-up creating a mhome folder, and doing a symlink in it pointing to the desired directories. It is a sound solution and has the exact same effect.
Dotfiles are dotfiles, because you're not normally supposed to see them. You configuring everything to always show them is like shooting yourself in the foot and complain about limping. My home dir looks exactly like your new one, without showing dotfiles lol.
Use zoxide and (almost) never type absolute paths again. Also, an alternative to your setup would be symlinking the stuff you need to a separate directory instead of moving it. Or maybe an overlayfs-based approach, which would eliminate the need to create symlinks manually. Yeah, I think I'm gonna try this!
this should work in any posix shell: cd() { if [ “$#” -eq 0 ]; then command cd “$HOME/mhome” else command cd “$@“ if } in bash, you can simplify it to cd(){ builtin cd “${1-$HOME/mhome}” “${@:2}”; }
Every time someone says to me that I shouldn't store my folders in my /home/user/Desktop directory, I show them what happens to my Home directory. Same thing applies to the Documents folder, IDK why programs feel the need to dump their crap in there too.
Hey, I made that comment. The way you've done it will probably have fewer pit-falls than mine - I moved the home directory with usermod to "Local" as a kinda "appdata drawer" of sorts (like Library on OS X and AppData on Windows) in line with the naming convention of the rest of the user-dirs, but this causes me to have to reveal home to certain flatpaks manually. I just did it that way because I originally wanted to move "~/.config" to "~/.local/etc". The way you've done it will probably only have minor annoyances with apps that ignore the user-dirs by default - but you could just symlink all those directories from your old home to your new home and forget about it. Of course, there's also the annoyance of "~" being defined as $HOME no matter what; I just created a variable called FH (files home) and use $FH in commands in place of ~. I actually might change to doing it this way instead as well, because "~/../" is less intuitive than something like "~/files". I actually doubt "~/home" would cause any problems but "/home/name/home" does look a little weird; could change the default home directory location to "/users/" like some other unices do so that it would be "/users/name/home" - though this may cause an issue for any program made by an idiotic developer who hardcodes "/home/$USER" rather than using "$HOME".
I actually did this for another reason - I have all my personal files on a different drive. It had the unintended, but nice effect of having a clean home directory even though my real system home directory is quite a mess. Nemo seems to only respect the XDG DIRS for the Desktop folder so I have to make new bookmarks for the rest, but it works great overall and my home directory is completely separate from my system meaning I can do whatever I want, even wipe it and install a different OS without my home directory ever being touched. Never thought of making an alias but that's a neat idea! Anyone who uses fish (imo the best shell out there), you can set aliases with the command: alias --save name_of_alias "actual command you want to execute" Note that you must add the --save argument or it will not carry over to new terminal sessions!
I have a dedicated drive for other files, which I call "My" (short for my files, like in My/Music or My/Videos). Its root of the drive contains folders like "Music" and "Documents" in example. I just bind them into my home with fstab. You can think of the drive as my mhome basically, without changing variables or like that. So if I don't want to see my home stuff, then I just go to "My"
I've been doing this for years. I label it "profile". I even do the same thing on (my sole) Windows machine, create a "Profile" folder on the C: root. I have an environment variable $PROFILE that points to it and so on. Works great and keeps things nice and organized.
i don't have a file manager, i always see the hidden files on terminal too, but it doesn't bother me, for the simple reason of having no personal file. i don't have photos, i don't have videos, music etc. so essentially my home directory is for those dotfiles :D they are not the mess, they are main reason of the directory for me. if i am in the home directory, i am in there for editing dotfiles, that's the only reason i am there. but i still like watching videos about these kinda creative solutions. like you said, it was brilliance.
Interesting take on how to view the home directory. Question: You don't have any personal files whatsoever or do you keep them elsewhere (cloud, phone etc.)? I know some keep all their docs, pics, vids etc. in the google cloud
What about leaving /home as it is. Get separate disc to store folders like there (Documents, Downloads...etc), so basically you treat /home like folder for configs, and you have files on different place so you will be able to reinstall system without losing data?
Do you read the bottom of the comment sections? I wrote how you can achieve something similar in a less hacky and much simpler way, but apparently YT doesn't like it.
Why wouldn't you do the opposite? You mention 4:41 changing the env var would just be moving the problem somewhere else, but isn't that exactly what you want? Then you can use actual /home as normal
Exactly what I was thinking! I'd rather have the default home for my personal stuff with one extra directory which will be considered the new $HOME where all the dotdirs and dotfiles will be dumped by programs, which I don't mind at all.
@@that_leafletApps which do use "/home/$USER" should have this reported as a bug - it breaks basic functionality on any system which do not put homes in /home - Fedora Silverblue for example, which uses "/var/home", and MacOS which uses "/Users"
I used a similar approach symlink Documents, Desktop and all those folders to a new location. It was easier so I could format easily my home subvolume on btrfs, and is also a really fast way to start with clean dotfiles. All the data I care about is in the other location anyway. But I never did it to have a clean home, it's good enough for me (after setting some env and all that).
This is a pretty good tutorial .... I used to do the Data partition or folder back in the day when symlinking was all the craze.... but symlinks are messy too in the way so I went back to regular old Home and just dealt with the mess.... Oh Matt by default the ls command does not show hidden files or folders... It's common these that developers of whatever Linux Distro inject their own ideas on how to use linux commands thus you sometimes get Aliases that shouldn't happen. Example sometimes I see ls command set as an alias to ls -a option. To those who don't know about Linux Aliases it allows users to rename commands or create new commands with scripting to change the behavior of the current command and the -a options tells ls to list all. Typing ls -a isn't that hard and instead of changing the definition of ls using alias it would have been better to give the ls -a option a new name and keep normal function of ls which does NOT show hidden files and folders as a default state..... Check your distro to see where they may put their aliases. I never used openSUSE so can't help you there... Now I just filter the results sometimes combining ls with grep if I get tired of typing a super long command I just use bash or shell script and shorten it to a name.sh or alias to bash... I occasionally us system.d (where it makes sense not all linux distros use system.d so can't be too reliant). To bascially achieve what I need accomplish to keep my filesystem clean and human readable . I haven't really dug in to learn all that is XDG has to offer but your short little example/tutorial really shows there is some cool use cases for it and I like how clean and easy to read the config looked so need to play around with this as NixOS is XDG compatible since symlinks in NixOS can be problematic.... Could see some use case with Distrobox as well to solve certain problems
Rather than using gh, you could use a function for cd instead of a standard alias. The function would detect if you have an argument passed to it (a directory), and if not, go to your new home.
Can you stack the backslashes to go further up? I mean, you know how Bash first looks for the name in aliases, then functions, then built-in commands, then hash tables, then in $PATH? If you have an alias, a function, and a buil-in command, can you use 2 backslashes before the name to get it to execute the built-in command?
The cd issue can be fixed by a custom function, e.g something like: cd() if (($# == 0)); then command cd $mhome; else command cd "$1"; fi For the dot directories, you can create one aggregate directory in your mhome and inside of it you can have symlinks to the actual dot directories from $HOME.
Thank you Matt, it is a truly smart way to organize. In the beginning of your video, you mentioned changing environment variables and for me, I am in favor of this. Personally, I am still learning a lot and I like to go to fix it. Articles and use the copy and paste function. If I change my home directory name and I need to point to it, this poppy feature will not work very well because my home directory name has changed and for times where it is important I will have to change the command I copied. Copied. But with changing environment variables, this activity will work. I want it to. Hope that makes sense. Have a great day!
what i do is run problematic programs inside of a wrapper script that changes the HOME variable to a fake home directory, then within that fake home, symlink common directories like .config and .local back to their normal counterparts in my real home, so that the fake home'd programs can access them like normal. everything seems to work seamlessly, and i'd argue it's simpler than this solution as there's less readjusting/configuring to do to get everything to use the fake home, as everything simply works as it's supposed to on account of the actual HOME variable being changed, but only on a per-program basis, so it avoids the issue you mentioned of changing HOME globally, which would just move the problem from one directory to another and not actually solve anything
Why just do not use function called cd in place of alias? When called without argument, it will call cd new home. When called with argument, it will call cd argument. You can call real cd, by example by providing full path.
I keep my personal files in my opt folder and steam games and other homie stuff in my home folder. Stuff that I want to delete goes into opt. I have them on separate drives too, which is what sparked the idea.
I did what you are doing expect some annoying app/services, but remember that OSuse use to hide the real home directory for any access different from booting the system, if somebody boot my pc from a live Linux, he could access to the new home directory, the solution is to encrypt the disk.
We all have our pet peeves, and this is clearly yours. Luckily, it doesn't much bother me. Yes, turning on and off hidden files in Thunar, ok, yeah, but I leave them off unless I'm specifically doing something with them. My .files issues are complicated by having .themes, .icons, etc and because I make music, I have .vst and vst3 folders, so I just can't be fussed. My goal is keeping it clean of regular files and having the rest of my stuff organized.
Yes, I don't like this either. Being my home directory I want to organize it as I like. In windows I didn't care, because all my stuff was in D:/ and didn't bother with My Documents. I really didn't care about anything in the C:/ partition, as I was ready anytime to reinstall.
What about just using boxxy? It even has a home-manager module, so you can set both the boxxy alias and boxxy config there. Other than that, is why I use Flatpak, Distrobox, and Conty. Conty in particular is convenient since they have a preset for setting HOME, and you can export .desktop files with that HOME and other SANDBOX settings baked in. I then just sed the name to say if it's sandboxed or not.
For cd, you could do something like this: cd() { if [ $# -eq 0 ]; then builtin cd ~/mhome else builtin cd "$@" fi } Tbh, though, we need Linus or someone to force a fix for this. It's silly how the home directory is used in linux. Windows does it better even. Sad
actually i done this years ago, called it Root... i synced those 1 folder over to windows, cloud and phone too.... now when i reinstall system, i only need to back up this folder, but then again, mostly it would be synced so i don't have to worry about it..
I've thought about, and decided to keep the config file separate. I just don't need to see it that often. The only good reason to transfer it or link it, is to ensure when I'm in $NEWHOME, I can cd into config without having to do the whole ~/.config. I just got around this by creating an alias.
Different approach would be to make links to those XDG folders. Not sure if it's better though. After that, I'd just change dolphin and terminal profile settings to open "my room" folder from original home as default
Why to move all these files and change All these configurations just use ln -s and link that directories your inside your new home directory. And for the cd thing u can defined a function in your rc file that checks for arguments if any preform the cd command as usual if not preform cd ~/mhome/
Thats why i have standard scripts, so that i can have a layer where i can create custom commands. Then you just create commands with shell scripts to make it behave like a home dir.
How is krusader better than several windows of some minimal and extensible fm like lf? Just open several instances if you do not want to create shortcuts/jump marks and move between dirs
@@TheLinuxCast Because you can see all instances at once and not have to go to hidden views. Sort of how would split pane fm look like. But if you insist on having tabs, you can switch your wm to a monocle or something similar where windows are stacked over each other. But I do not like tabs that much in browsers neither. If I cannot see it, I either move it to other workspace or close it
@@TheLinuxCast Haha sure. With all the clutter in your home and .config, I thought you would not mind that. But apart for more processes (not necessarily), you would likely end up with the same result while having app that is easier to modify and takes up less resources (even if having multiple instances (I wanted to confirm this but I do not want to install 300+ mb of dependencies for krusader))
i think your mess starts on KDE + i3 + xmonad + hyprland + Qtile + bspwm and Krusader + dolphin + thunar + yazy + ranger + spacefm and emacs + doom emacs + vim + neovim + kate + ...... its not all linux devs fault ;)
This would not be ok for me. I do not want to just move my starting point. But if it works for you, ok. You do not even need to move all directories like downloads and video, you can simply create symbolic links to your fake home and just make sure your fm opens there
For example, I have Downloads linked to write on a HDD instead of SSD where my home is. And apps write to ~/Downloads but that ends up on different mount point
Stop aliasing CD, use a function instead, if CD has no arguments or switches go home else run the command as is. No backslashes or escapes needed. Aliases are OK for basic tweaks, but you really should look into functions you can do so much more with them including maintaining original usage of commands, and creating multiple variants or saved configurations that can apply to changing arguments. :)
I did read, say the note before and after, but even though GH (go home) seems sane and simple (something I would totally do myself). It is entirely possible to maintain the original function of all the commands, and not need to remember additional ones, it makes things seamless. Also the moment you try GH on another system by force of habit it will interrupt your workflow. :)
I don't know if aliases are called recursively but if they are not you could Alias CD to your new home folder and Alias CD space to CD which would give you back its original functionality. However if the Alias works for recursively this wouldn't fix anything.
Matt, I'm 90% sure you're just explaining an extremely complex version of ls and alias la=ls -a If you want to see different files at different times, use a different command. Use aliases for common ones. No need to go moving files all over the place.. Practicality aside, pretty unique little setup either way. Still fun to see the weird things you can do with Linux lol
Alright, here's what you can do instead for very little effort: a) Create a ~/.local/state/fake-home/ directory. b) For any $program that litters in your ~ create a ~/.local/bin/$program wrapper script that calls /usr/bin/$program with HOME=…/fake-home and all the arguments untouched. A global location like /usr/local/bin/ is fine too. For more programs you can either copy the script and change the name or create one script that looks at $(basename "$0") and just symlink to it whenever you find something new. c) If you're using .desktop files, copy the ones that misbehave to ~/.local/share/applications/ and modify their Exec lines to set the fake home.
I already do something like this but I leave the main home directory alone as I know that's where all the config files usually goes to when you install something. But for the Documents, Pictures, Music, Videos, etc.... I change all their default locations to point to my other SSD storage drive which the OS is not installed on. This way even if I wipe my OS and install a new one, I can just point these folders again to that SSD storage drive. Been doing this since Windows and now on Linux... lol 🤪
On th CD issue ... yes, I know, many commented already. None provided the correct solution. So: - using "gh" alias instead of "cd" - works, but no it's not nice - using a function that can detect when it's with 0 arguments and behave accordingly - also works, absolutely horrible - using "dvd" alias instead of "cd" - the TRUE solution. Just level up the CD 😁
Instead of moving the folders to your new home directory. Why not just put a shortcut to them in there? That way you don't have to tell anything where they are, but you can still access them from your new clean-looking interface.
Now a real comment ... I wonder how complicated would be to just patch every misbehaving program to put the config files in the correct location. On Gentoo. Theoretically the change should be pretty small, and in a pretty stable place, for each program, but I'm too lazy and resistant to mess and chaos to care and check / do it. But it can be the most elegant solution. And no more CD or GH aliases nor fear of scripts.
Why not create symbolic links into your real home directory, keeping the normal file structure for everything in the home directory but having your "clean" home directory work similarly to a "favorites" directory in windows.
Honestly yeah I've gave up a long time ago and just created a local/ where MY stuff has been ghettoized to. I hadn't thought of xdg stuff though thanks
You shouldn't alias a built-in command imo. Would have saved trouble to alias as 'cdh' for example. Aliasing over a built-in command is a recipe for issues and incompatibility between systems.
I have moved my system to a virtual fs for each application. Basically all of them now resides in its own home. Zero clutter in my homedir. Some apps I had to patch so they worked as expected. The funny part is I can use different theming on apps with ease this way. It also gives me a direct view of apps that does not behave good. As they still do what they do normaly just without clutter.
honestly thats just way to much work for what can essentially be solved with not using -a with ls you basically go i hate seeing dotfiles while going out of your way to see dotfiles
You don't know DirectoryOpus, which makes your mistake about the best file manager forgiveable xD PS: Why don't you do: ln -s ~/.config ~/mhome/.config
Like this sort of content? Help out the channel by checking out my merch shop! shop.thelinuxcast.org
That seems like a inordinate amount of work to just not see dot files. But then again, haven't we all spent copious amounts of time at some point, fixing something that bothers literally no one else? The symptoms of a true nerd.
Sometimes I think the Windows "hidden" attribute would have been a good idea to have in Linux as well, in addition to dotfiles. This way we could mark any file we want to be hidden, without changing its filename and therefore path. If someone don't like that, then one could just ignore the hidden attribute and show all files.
That’s not a bad idea. In fact, prefixing a file name with a dot was not supposed to hide it. That was a bug that never got fixed, and now it’s considered intended behavior.
This is so true ! The things I waste time on that bug only me is almost embarrassing.
True. For me one example is MX Linux. It has a good set of right-click commands such as right-clicking on a file using the option to check the checksum. It bothered me so much that CRC32/SFV wasn't included---only MD5, SHA1, SHA256, and SHA512. I went out of my way to edit some system files to include CRC32 in the same place where the other file checksums are available and felt so guuuuud after I have it working perfectly the way I want it.
Why include CRC32? I dunno... I'm just so familiar using that file checksum during my IRC anime fserver days... it just stuck on me ya know? 🤪
This is over-complicated. The way I do this is to make a /data directory, then move and symlink my home directories accordingly to this directory (also some config files get moved here). Then I do not have to change all those system configs you are talking about, as the way Linux sees things, everything is still where it belongs. Also, to backup my system, all I need to grab is /data. If it is not in /data, then it can be re-installed and I do not need to worry about it.
Was about to post the same thing. Any critical dot files/directories back up to /data. Examples. .ssh .gpg .bashrc etc
.user-dirs.dirs I do edit this, but only once
Me too, and the folder is synced to my NAS so that it makes it very easy to reinstall the OS if needed. Issue is remembering which folders are important to create symlinks when first installed 😂
After reading your comment, I ended-up creating a mhome folder, and doing a symlink in it pointing to the desired directories. It is a sound solution and has the exact same effect.
Dotfiles are dotfiles, because you're not normally supposed to see them. You configuring everything to always show them is like shooting yourself in the foot and complain about limping.
My home dir looks exactly like your new one, without showing dotfiles lol.
Use zoxide and (almost) never type absolute paths again. Also, an alternative to your setup would be symlinking the stuff you need to a separate directory instead of moving it. Or maybe an overlayfs-based approach, which would eliminate the need to create symlinks manually. Yeah, I think I'm gonna try this!
You can make cd a function which behaves as normal cd when number of arguments is more than 0.
this should work in any posix shell:
cd() {
if [ “$#” -eq 0 ]; then
command cd “$HOME/mhome”
else
command cd “$@“
if
}
in bash, you can simplify it to
cd(){ builtin cd “${1-$HOME/mhome}” “${@:2}”; }
Every time someone says to me that I shouldn't store my folders in my /home/user/Desktop directory, I show them what happens to my Home directory. Same thing applies to the Documents folder, IDK why programs feel the need to dump their crap in there too.
I also don't like the clutter. But all of this is way more hassle than it's worth. At least to me.
Hey, I made that comment. The way you've done it will probably have fewer pit-falls than mine - I moved the home directory with usermod to "Local" as a kinda "appdata drawer" of sorts (like Library on OS X and AppData on Windows) in line with the naming convention of the rest of the user-dirs, but this causes me to have to reveal home to certain flatpaks manually. I just did it that way because I originally wanted to move "~/.config" to "~/.local/etc".
The way you've done it will probably only have minor annoyances with apps that ignore the user-dirs by default - but you could just symlink all those directories from your old home to your new home and forget about it. Of course, there's also the annoyance of "~" being defined as $HOME no matter what; I just created a variable called FH (files home) and use $FH in commands in place of ~.
I actually might change to doing it this way instead as well, because "~/../" is less intuitive than something like "~/files". I actually doubt "~/home" would cause any problems but "/home/name/home" does look a little weird; could change the default home directory location to "/users/" like some other unices do so that it would be "/users/name/home" - though this may cause an issue for any program made by an idiotic developer who hardcodes "/home/$USER" rather than using "$HOME".
In Bash and ZSH and any other shell, you can have if statements.
I actually did this for another reason - I have all my personal files on a different drive. It had the unintended, but nice effect of having a clean home directory even though my real system home directory is quite a mess. Nemo seems to only respect the XDG DIRS for the Desktop folder so I have to make new bookmarks for the rest, but it works great overall and my home directory is completely separate from my system meaning I can do whatever I want, even wipe it and install a different OS without my home directory ever being touched. Never thought of making an alias but that's a neat idea!
Anyone who uses fish (imo the best shell out there), you can set aliases with the command: alias --save name_of_alias "actual command you want to execute" Note that you must add the --save argument or it will not carry over to new terminal sessions!
I have a dedicated drive for other files, which I call "My" (short for my files, like in My/Music or My/Videos). Its root of the drive contains folders like "Music" and "Documents" in example. I just bind them into my home with fstab. You can think of the drive as my mhome basically, without changing variables or like that. So if I don't want to see my home stuff, then I just go to "My"
I've been doing this for years. I label it "profile". I even do the same thing on (my sole) Windows machine, create a "Profile" folder on the C: root. I have an environment variable $PROFILE that points to it and so on. Works great and keeps things nice and organized.
i don't have a file manager, i always see the hidden files on terminal too, but it doesn't bother me, for the simple reason of having no personal file. i don't have photos, i don't have videos, music etc. so essentially my home directory is for those dotfiles :D they are not the mess, they are main reason of the directory for me. if i am in the home directory, i am in there for editing dotfiles, that's the only reason i am there. but i still like watching videos about these kinda creative solutions. like you said, it was brilliance.
Interesting take on how to view the home directory. Question: You don't have any personal files whatsoever or do you keep them elsewhere (cloud, phone etc.)? I know some keep all their docs, pics, vids etc. in the google cloud
I would get so lost doing this. I want to know if you stick with it
What about leaving /home as it is. Get separate disc to store folders like there (Documents, Downloads...etc), so basically you treat /home like folder for configs, and you have files on different place so you will be able to reinstall system without losing data?
Do you read the bottom of the comment sections?
I wrote how you can achieve something similar in a less hacky and much simpler way, but apparently YT doesn't like it.
Why wouldn't you do the opposite? You mention 4:41 changing the env var would just be moving the problem somewhere else, but isn't that exactly what you want? Then you can use actual /home as normal
Exactly what I was thinking! I'd rather have the default home for my personal stuff with one extra directory which will be considered the new $HOME where all the dotdirs and dotfiles will be dumped by programs, which I don't mind at all.
Some apps still may target /home/$USER rather than ~. So your solution would be fine for most apps, but not the worst offenders.
@@that_leafletApps which do use "/home/$USER" should have this reported as a bug - it breaks basic functionality on any system which do not put homes in /home - Fedora Silverblue for example, which uses "/var/home", and MacOS which uses "/Users"
I used a similar approach symlink Documents, Desktop and all those folders to a new location. It was easier so I could format easily my home subvolume on btrfs, and is also a really fast way to start with clean dotfiles. All the data I care about is in the other location anyway. But I never did it to have a clean home, it's good enough for me (after setting some env and all that).
You could also just make those folders subvolumes inside the home subvolume. Snapshots aren't recursive when a subvolume is inside another one
This is a pretty good tutorial .... I used to do the Data partition or folder back in the day when symlinking was all the craze.... but symlinks are messy too in the way so I went back to regular old Home and just dealt with the mess.... Oh Matt by default the ls command does not show hidden files or folders... It's common these that developers of whatever Linux Distro inject their own ideas on how to use linux commands thus you sometimes get Aliases that shouldn't happen. Example sometimes I see ls command set as an alias to ls -a option. To those who don't know about Linux Aliases it allows users to rename commands or create new commands with scripting to change the behavior of the current command and the -a options tells ls to list all. Typing ls -a isn't that hard and instead of changing the definition of ls using alias it would have been better to give the ls -a option a new name and keep normal function of ls which does NOT show hidden files and folders as a default state..... Check your distro to see where they may put their aliases. I never used openSUSE so can't help you there...
Now I just filter the results sometimes combining ls with grep if I get tired of typing a super long command I just use bash or shell script and shorten it to a name.sh or alias to bash... I occasionally us system.d (where it makes sense not all linux distros use system.d so can't be too reliant). To bascially achieve what I need accomplish to keep my filesystem clean and human readable . I haven't really dug in to learn all that is XDG has to offer but your short little example/tutorial really shows there is some cool use cases for it and I like how clean and easy to read the config looked so need to play around with this as NixOS is XDG compatible since symlinks in NixOS can be problematic.... Could see some use case with Distrobox as well to solve certain problems
Rather than using gh, you could use a function for cd instead of a standard alias. The function would detect if you have an argument passed to it (a directory), and if not, go to your new home.
I just realized my idea was already mentioned by @ayushrawal706 . My bad
Can you stack the backslashes to go further up? I mean, you know how Bash first looks for the name in aliases, then functions, then built-in commands, then hash tables, then in $PATH? If you have an alias, a function, and a buil-in command, can you use 2 backslashes before the name to get it to execute the built-in command?
The cd issue could also be replaced with a function where if blank then CD to $newhome else CD $1
The cd issue can be fixed by a custom function, e.g something like: cd() if (($# == 0)); then command cd $mhome; else command cd "$1"; fi
For the dot directories, you can create one aggregate directory in your mhome and inside of it you can have symlinks to the actual dot directories from $HOME.
Thank you Matt, it is a truly smart way to organize. In the beginning of your video, you mentioned changing environment variables and for me, I am in favor of this. Personally, I am still learning a lot and I like to go to fix it. Articles and use the copy and paste function. If I change my home directory name and I need to point to it, this poppy feature will not work very well because my home directory name has changed and for times where it is important I will have to change the command I copied. Copied. But with changing environment variables, this activity will work. I want it to. Hope that makes sense. Have a great day!
what i do is run problematic programs inside of a wrapper script that changes the HOME variable to a fake home directory, then within that fake home, symlink common directories like .config and .local back to their normal counterparts in my real home, so that the fake home'd programs can access them like normal. everything seems to work seamlessly, and i'd argue it's simpler than this solution as there's less readjusting/configuring to do to get everything to use the fake home, as everything simply works as it's supposed to on account of the actual HOME variable being changed, but only on a per-program basis, so it avoids the issue you mentioned of changing HOME globally, which would just move the problem from one directory to another and not actually solve anything
Thanks.. seems good idea
I'm with "pretend they're not there" camp, dot files are hidden for a reason )
Why just do not use function called cd in place of alias? When called without argument, it will call cd new home. When called with argument, it will call cd argument. You can call real cd, by example by providing full path.
I keep my personal files in my opt folder and steam games and other homie stuff in my home folder.
Stuff that I want to delete goes into opt. I have them on separate drives too, which is what sparked the idea.
I did what you are doing expect some annoying app/services, but remember that OSuse use to hide the real home directory for any access different from booting the system, if somebody boot my pc from a live Linux, he could access to the new home directory, the solution is to encrypt the disk.
I am totally OCD about my home directory too 😂. I feel a little more normal to relate to you about this. I thought it was a just me thing
We all have our pet peeves, and this is clearly yours. Luckily, it doesn't much bother me. Yes, turning on and off hidden files in Thunar, ok, yeah, but I leave them off unless I'm specifically doing something with them. My .files issues are complicated by having .themes, .icons, etc and because I make music, I have .vst and vst3 folders, so I just can't be fussed. My goal is keeping it clean of regular files and having the rest of my stuff organized.
for 8:30; I'd personally would have used a function instead of an alias for cd.
I just changed it to gh, as I said in the video. It was easier and makes me forcably remember what I've done
Yes, I don't like this either. Being my home directory I want to organize it as I like. In windows I didn't care, because all my stuff was in D:/ and didn't bother with My Documents. I really didn't care about anything in the C:/ partition, as I was ready anytime to reinstall.
What about just using boxxy? It even has a home-manager module, so you can set both the boxxy alias and boxxy config there.
Other than that, is why I use Flatpak, Distrobox, and Conty. Conty in particular is convenient since they have a preset for setting HOME, and you can export .desktop files with that HOME and other SANDBOX settings baked in. I then just sed the name to say if it's sandboxed or not.
I've never seen boxxy before, but it looks like magic. I will look at it.
I totally feel you. It seems like almost no one else understands us ¯\_(ツ)_/¯
For cd, you could do something like this:
cd() {
if [ $# -eq 0 ]; then
builtin cd ~/mhome
else
builtin cd "$@"
fi
}
Tbh, though, we need Linus or someone to force a fix for this. It's silly how the home directory is used in linux. Windows does it better even. Sad
I wonder what ~ looks like in MacOS. Where are their .zshrc, .ssh, .mozilla, etc.?
actually i done this years ago, called it Root...
i synced those 1 folder over to windows, cloud and phone too....
now when i reinstall system, i only need to back up this folder, but then again, mostly it would be synced so i don't have to worry about it..
Or, you can make a favorites folder with 'software links' to those directories, you can even call it 'home' if you want
You can sim link config folder to the new home directory😁
I've thought about, and decided to keep the config file separate. I just don't need to see it that often. The only good reason to transfer it or link it, is to ensure when I'm in $NEWHOME, I can cd into config without having to do the whole ~/.config. I just got around this by creating an alias.
Different approach would be to make links to those XDG folders. Not sure if it's better though.
After that, I'd just change dolphin and terminal profile settings to open "my room" folder from original home as default
Why to move all these files and change All these configurations just use ln -s and link that directories your inside your new home directory.
And for the cd thing u can defined a function in your rc file that checks for arguments if any preform the cd command as usual if not preform cd ~/mhome/
As I explained to others, links break.
Thats why i have standard scripts, so that i can have a layer where i can create custom commands. Then you just create commands with shell scripts to make it behave like a home dir.
How is krusader better than several windows of some minimal and extensible fm like lf? Just open several instances if you do not want to create shortcuts/jump marks and move between dirs
Why on earth would I want to open up several instances of anything? That's what tabs were invented for
@@TheLinuxCast Because you can see all instances at once and not have to go to hidden views. Sort of how would split pane fm look like. But if you insist on having tabs, you can switch your wm to a monocle or something similar where windows are stacked over each other. But I do not like tabs that much in browsers neither. If I cannot see it, I either move it to other workspace or close it
That's what panes are for. And I don't need multiple running instances. PID bloat
@@oalfodr
@@TheLinuxCast Haha sure. With all the clutter in your home and .config, I thought you would not mind that. But apart for more processes (not necessarily), you would likely end up with the same result while having app that is easier to modify and takes up less resources (even if having multiple instances (I wanted to confirm this but I do not want to install 300+ mb of dependencies for krusader))
i think your mess starts on KDE + i3 + xmonad + hyprland + Qtile + bspwm and Krusader + dolphin + thunar + yazy + ranger + spacefm and emacs + doom emacs + vim + neovim + kate + ...... its not all linux devs fault ;)
This would not be ok for me. I do not want to just move my starting point. But if it works for you, ok. You do not even need to move all directories like downloads and video, you can simply create symbolic links to your fake home and just make sure your fm opens there
For example, I have Downloads linked to write on a HDD instead of SSD where my home is. And apps write to ~/Downloads but that ends up on different mount point
Stop aliasing CD, use a function instead, if CD has no arguments or switches go home else run the command as is. No backslashes or escapes needed. Aliases are OK for basic tweaks, but you really should look into functions you can do so much more with them including maintaining original usage of commands, and creating multiple variants or saved configurations that can apply to changing arguments. :)
A common function some people put in their bashrc is mkcd, if dir exists CD into it, if not mkdir and then CD into it.
Read the screen.
I did read, say the note before and after, but even though GH (go home) seems sane and simple (something I would totally do myself). It is entirely possible to maintain the original function of all the commands, and not need to remember additional ones, it makes things seamless. Also the moment you try GH on another system by force of habit it will interrupt your workflow. :)
Sorry, didn't mean to get snappy. Just had four comments like yours all at the same time@@pimactv9778
I don't know if aliases are called recursively but if they are not you could Alias CD to your new home folder and Alias CD space to CD which would give you back its original functionality. However if the Alias works for recursively this wouldn't fix anything.
just use a function
I'm confused how using a GUI file manager is different than just not aliasing ls to ls -a ???
Am I missing something?
Matt, I'm 90% sure you're just explaining an extremely complex version of ls and alias la=ls -a
If you want to see different files at different times, use a different command. Use aliases for common ones. No need to go moving files all over the place..
Practicality aside, pretty unique little setup either way. Still fun to see the weird things you can do with Linux lol
Alright, here's what you can do instead for very little effort:
a) Create a ~/.local/state/fake-home/ directory.
b) For any $program that litters in your ~ create a ~/.local/bin/$program wrapper script that calls /usr/bin/$program with HOME=…/fake-home and all the arguments untouched. A global location like /usr/local/bin/ is fine too. For more programs you can either copy the script and change the name or create one script that looks at $(basename "$0") and just symlink to it whenever you find something new.
c) If you're using .desktop files, copy the ones that misbehave to ~/.local/share/applications/ and modify their Exec lines to set the fake home.
Gonna have a play with that myself. Ta for the idea. 🙂
Great hack, thank you sir !
I already do something like this but I leave the main home directory alone as I know that's where all the config files usually goes to when you install something. But for the Documents, Pictures, Music, Videos, etc.... I change all their default locations to point to my other SSD storage drive which the OS is not installed on. This way even if I wipe my OS and install a new one, I can just point these folders again to that SSD storage drive. Been doing this since Windows and now on Linux... lol 🤪
On th CD issue ... yes, I know, many commented already. None provided the correct solution. So:
- using "gh" alias instead of "cd" - works, but no it's not nice
- using a function that can detect when it's with 0 arguments and behave accordingly - also works, absolutely horrible
- using "dvd" alias instead of "cd" - the TRUE solution. Just level up the CD 😁
Instead of moving the folders to your new home directory. Why not just put a shortcut to them in there? That way you don't have to tell anything where they are, but you can still access them from your new clean-looking interface.
I go a step farther. I put a secondary hard drive in my rig. I let the computer use the "c drive" and my 2nd drive is my directory filing cabinet.
Now a real comment ... I wonder how complicated would be to just patch every misbehaving program to put the config files in the correct location. On Gentoo. Theoretically the change should be pretty small, and in a pretty stable place, for each program, but I'm too lazy and resistant to mess and chaos to care and check / do it. But it can be the most elegant solution. And no more CD or GH aliases nor fear of scripts.
Why not create symbolic links into your real home directory, keeping the normal file structure for everything in the home directory but having your "clean" home directory work similarly to a "favorites" directory in windows.
That's Documents folder
Honestly yeah I've gave up a long time ago and just created a local/ where MY stuff has been ghettoized to.
I hadn't thought of xdg stuff though thanks
You shouldn't alias a built-in command imo. Would have saved trouble to alias as 'cdh' for example. Aliasing over a built-in command is a recipe for issues and incompatibility between systems.
If you noticed I said in text on screen that I changed it.
Commented too soon haha. You mentioned this right after I unpaused. Sorry!
No worries.@@CandyCaneChris
I have moved my system to a virtual fs for each application.
Basically all of them now resides in its own home.
Zero clutter in my homedir.
Some apps I had to patch so they worked as expected.
The funny part is I can use different theming on apps with ease this way.
It also gives me a direct view of apps that does not behave good.
As they still do what they do normaly just without clutter.
honestly thats just way to much work for what can essentially be solved with not using -a with ls
you basically go i hate seeing dotfiles while going out of your way to see dotfiles
I don't use ls
@@TheLinuxCast why would any software default to show hidden directories thats so bad
and you can get rid of capital letters also documents not Documents !!
I tried this method by myself before .. but didn't like it
There should be a more robust solution..
just create a home folder in your home directory
GVM.
Why don't you just soft link to your mhome and not make actual new directories?
Links can be broken
This seems more like a hack though, like you are just putting things from left to right hand
I mean, hack is right in the title.
J. effin C. ! A hack for sure. Easier to just install Windows ;) lol
This video about home directories is interesting and informative. No, I'm not a bot... or, am I?
i too am not a bot that is interested in linux home directories.
Click-bait title. If you seriously believe this is "The Ultimate Linux Hack" you've got a lot to learn. Nice presentation, though.
Here's a guy who's never been on TH-cam before.
But thanks,
Oh dear, Matt I think this may be a little too **** retentive for me.
do you even symlink bro? lol but seriously....
Links break.
look at man ln and ln -s
Or just unalias ls 😂
I don't use ls, and I *want* to see the hidden files that are supposed to be there.
...
You don't know DirectoryOpus, which makes your mistake about the best file manager forgiveable xD
PS: Why don't you do: ln -s ~/.config ~/mhome/.config
If only I used Windows...not
@@TheLinuxCast Amiga. :)