I thought I’ll make this thread for all of you out there who have questions but are afraid to ask them. This is your chance!
I’ll try my best to answer any questions here, but I hope others in the community will contribute too!
How do symlinks work from the point of view of software?
Imagine I have a file in my downloads folder called movie.mp4, and I have a symlink to it in my home folder.
Whenever I open the symlink, does the software (player) understand «oh this file seems like a symlink, I should go and open the original file», or it’s a filesystem level stuff and software (player) basically has no idea if a file I’m opening is a symlink or the original movie.mp4?
Can I use sync software (like Dropbox, Gdrive or whatever) to sync symlinks? Can I use sync software to sync actual files, but only have symlinks in my sync folder?
Is there a rule of thumb to predict how software behaves when dealing with symlinks?
I just don’t grok symbolic links.
A symlink works more closely to the first way you described it. The software opening a symlink has to actually follow it. It’s possible for a software to not follow the symlink (either intentionally or not).
So your sync software has to actually be able to follow symlinks. I’m not familiar with how gdrive and similar solutions work, but I know this is possible with something like rsync
So I guess it’s something like pressing ctrl+c: most software doesn’t specifically handle this hotkey so in general it will interrupt a running process, but software can choose to handle it differently (like in vim ctrl+C does not interrupt it).
Thanks.
Fun fact: pressing X (close button) on a window does not make it that your app is closed, it just sends a signal that you wish to close it, your app can choose what to do with this signal.
Software opens a symlink the same way as a regular file. The kernel reads a path stored in a symlink and then opens a file with that path (or returns a error if unable to do this for some reason). But if a program needs to perform specific actions on symlinks, it is able to check the file type and resolve symlink path.
To determine how some specific software handle symlinks, read its documentation. It may have settigs like “follow symlinks” or “don’t follow symlinks”.
ELI5: when a computer stores something like a file or a folder, it needs to know where it lives and where its contents are stored. Normally where the a file or folder lives is the same place as where its contents are. But there are times where a file may live in one place and its contents are elsewhere. That’s a symlink.
So for your video example, the original video is located in Downloads so the video file will say I am movie.mp4 and I live i live in downloads, and my contents are in downloads. While the symlink says, I am movie.mp4 I live in home, and my contents are in downloads over there.
For a video player, it doesn’t care if the file and the content is in the same place, it just need to know where the content lives.
Now how software will treat a symlink as an absolute. For example if you have 2 PCs synced with cloud storage, and both downloads and home is being synced between your 2 pcs. Your cloud storage will look at the symlink, access the content from pc1 and put your movie.mp4 in pc2’s downloads and home. But it will also put the contents in both places in pc2 since to it, the results are the same. One could make software sync without breaking the symlink, but it depends on the developer and the scope of the software.
Whenever I open the symlink, does the software (player) understand «oh this file seems like a symlink, I should go and open the original file», or it’s a filesystem level stuff and software (player) basically has no idea if a file I’m opening is a symlink or the original movie.mp4?
Others have answered well already, I just will say that symlinks work at the filesystem level, but the operating system is specially programmed to work with them. When a program asks the operating system to open a file at a given path, the OS will automatically “reference” the link, meaning it will detect a symlink and jump to the place where the symlink is pointing.
A program may choose to inspect whether a file is a symlink or not. By default, when a program opens a file, it simply allows the operating system to reference the file path for it.
But some apps that work on directories and files together (like “
find
”, “tar
”, “zip
”, or “git
”) do need to worry about symlinks, and will check if a path is a symlink before deciding whether to reference it. For example, you can ask the “find
” command to list only symlinks without referencing them:find -type l
its a pointer.
E: Okay so someone downvoted “it’s a pointer”. Here goes. both hard links and symbolic links are pointers.
The hard link is a pointer to a spot on the block device, whereas the symbolic link is a pointer to the location in the filesystems list of shit.
That location in the filesystems list of shit is also a pointer.
So like if you have /var/2girls1cup.mov, and you click it, the os looks in the file system and sees that /var/2girls1cup.mov means 0x123456EF and it looks there to start reading data.
If you make a symlink to /var/2girls1cup.mov in /bin called “ls” then when you type “ls”, the os looks at the file in /bin/ls, sees that it points to /var/2girls1cup.mov, looks in the file system and sees that it’s at 0x123456EF and starts reading data there.
If you made a hard link in /bin called ls it would be a pointer to the location on the block device, 0x123456EF. You’d type “ls” and the os would look in the file system for /bin/ls, see that /bin/ls means 0x123456EF and start reading data from there.
Okay but who fucking cares? This is stupid!
If you made /bin/ls into /var/2girls1cup.mov with a symlink then you could use normal tools to work with it, looking at where it points, it’s attributes etc and like delete just the link or fully follow (dereference) the link and delete all the links in the chain including the last one which is the filesystems pointer to 0x123456EF called /var/2girls1cup.mov in our example.
If you made /bin/ls into a hardlink to 0x123456EF, then when you did stuff to it the os wouldn’t know it’s also called /var/2girls1cup.mov and when /bin/ls didn’t work as expected you’d have to diff the output of mediainfo on both files to see that it’s the same thing and then look where on the hard drive /var/2girls1cup.mov and /bin/ls point to and compare em to see oh, someone replaced my ls with a shock video using a hard link.
When you delete the /bin/ls hardlink, the os deletes the entry in the file system pointing to 0x123456EF and you are able to put normal /bin/ls back again. Deleting the hard link wouldn’t actually remove the data that comprises that file off the drive because “deleting” a “file” is just removing the file systems record that there’s something there to be aware of.
If instead of deleting the /bin/ls hardlink, you opened it up and replaced the video portion of its data with the music video to never gonna give you up, then when someone tried to open /var/2girls1cup.mov they’d instead see that music video.
if that is, the file wasn’t moved to another place on the block device when you changed it. Never gonna give you up has a much longer running time than 2girls1cup and without significant compression the os is gonna end up putting /bin/ls in a different place in the block device that can accommodate the longer data stream. If the os does that when you get done modifying your 2girls1cup /bin/ls into rickroll then /bin/ls will point to 0x654321EF or something and only you will experience astleys dulcet tones when you use ls, the old 0x123456EF location will still contain the data that /var/2girls1cup.mov is meant to point to and you will have played yourself.
Okay with all that said: how does the os know what to do when one of its standard utilities encounters a symlink? They have a standard behavior! It’s usually to “follow” (dereference) the link. What the fuck good would a symbolic link be if it didn’t get treated normally? Sometimes though, like with “ls” or “rm” you might want to see more information or just delete the link. In those cases you gotta look at how the software you’re trying to use treats links.
Or you can just make some directories and files with touch and try what you wanna do and see what happens, that’s what I do.
In the terminal, why can’t i paste a command that i have copied to the clipboard, with the regular Ctrl+V shortcut? I have to actually use the mouse and right click to then select paste.
(Using Mint cinnamon)
The terminal world has Ctrl+C and Ctrl+(many other characters) already reserved for other things before they ever became standard for copy paste. For for this reason, Ctrl+Shift+(C for copy, V for paste) are used.
In Terminal land, Ctrl+C has meant Cancel longer than it’s meant copy. Shift + Insert does what you think Ctrl+V will do.
Also, there’s a separate thing that exists in most window managers called the Primary buffer, which is a separate thing from the clipboard. Try this: Highlight some text in one window, then open a text editor and middle click in it. Ta da! Reminder: This has absolutely nothing to do with the clipboard, if you have Ctrl+X or Ctrl+C’d something, this won’t overwrite that.
Old timer here! As many others replying to you indicate, Ctrl+C means SIGINT (interrupt running program). Many have offered the Ctrl+Shift+C, but back in my day, we used Shift+Insert (paste) and Ctrl+Insert (copy). They still work today, but Linux has 2 clipboard buffers and Shift+Insert works against the primary.
As an aside, on Wayland, you can use wl-paste and wl-copy in your commands, so
git clone "$(wl-paste)"
will clone whatever repo you copied to your clipboard. I use this one all the timeDoes Ctrl+Shift+V work?
In most terminal (gnome terminal, blackbox, tilix etc.) you can actually override this behavior by changing keyboard shortcut. Blackbox even have a simple toggle that will enable ctrl+c v copy paste.
Gnome console is the only terminal I know that doesn’t allow you to change this.
Interesting! Ill check that out with mint!
Try ctrl+shift+v, iirc in the terminal ctrl+v is used as some other shortcut (and probably has been since before it was standard for “paste” I’d bet).
Also linux uses two clipboards iirc, the ctrl+c/v and the right click+copy/paste are two distinct clipboards.
What usually also works on Linux is selecting text with the mouse and pasting it by pressing the middle mouse button (or scroll wheel). You’d still need the mouse, but it’s at least a little quicker ☺️
Use shift+control+v to paste. Shift+control+c to copy in the terminal. It’s this way because control+c in the terminal is to break out of the currently running process.
Ctrl+V is already a shortcut for something (I don’t even know what) but to paste just add shift so Ctrl+Shift+V.
(Also a beginner btw)
Ctrl+shift+V is what you should do. Ctrl+V is used by shells for I believe inserting characters without doing some sort of evaluation. I don’t remember the specifics though, but yes Ctrl+shift+V to paste.
Maybe not a super beginner question, but what do awk and sed do and how do I use them?
This is 80% of my usage of awk and sed:
“ugh, I need the 4th column of this print out”:
command | awk '{print $4}'
Useful for getting pids out of a
ps
command you applied a bunch ofgrep
s to.”hm, if I change all ‘this’ to ‘that’ in the print out, I get what I want":
command | sed "s/this/that/g"
Useful for a lot of things, like “I need to change the urls in this to that” or whatever.
Basically the rest I have to look up.
I say that covers around 99% of the awk/sed I use.
I was gonna write 99%, but then I remember I also need capture groups quite often. That would make 99% I’d say
Awk lets you do operations based on patterns. You can make little scripts and mini programs with it.
Sed lets you edit streams.
Almost everything can be treated like a stream so with those two tools you have the power to do damn near everything ever.
If you’re gonna dive into sed and awk, I’d also highly recommend learning at least the basics of regular expressions. The book Mastering Regular Expressions has been tremendously helpful for me.
Edit: a letter. Stupid autocorrect.
Awk is a programming language designed for reading files line by line. It finds lines by a pattern and then runs an action on that line if the pattern matches. You can easily write a 1-line program on the command line and ask Awk to run that 1-line program on a file. Here is a program to count the number of “comment” lines in a script:
awk 'BEGIN{comment_count=0;} /^[[:space:]]*[#]/{comment_count++;} END{print(comment_count);}' file.sh
It is a good way to inspect the content of files, espcially log files or CSV files. But Awk can do some fairly complex file editing operations as well, like collating multiple files. It is a complete programming language.
Sed works similar to Awk, but it is much simplified, and designed mostly around CLI usage. The pattern language is similar to Awk, but the commands are usually just one or two letters representing actions like “print the line” or “copy the line to the in-memory buffer” or “dump the in-memory buffer to output.”
Is there an Android emulator that you can actually game on? I’ve tried a number of them (Android x86, Genymotion, Waydroid), but none of them can install a multitude of games from the Google Play store. The one thing keeping me on Windows is Android emulation (I like having one or two idle games running at any given time).
By default waydroid uses an x86 android image. Most games are not build for x86.
I have followed this to run an arm android image. https://wiki.archlinux.org/title/Waydroid#ARM_Apps_Incompatible
With that, I was able to install all apps.
Most probably, no. I tried to run bluestacks on wine. Some game works, most of em don’t
What is the system32 equivalent in linux
/bin, since that will include any basic programs (bash, ls, cd, etc.).
As in, the directory in which much of the operating system’s executable binaries are contained in?
They’ll be spread between /bin and /sbin, which might be symlinks to /usr/bin and /usr/sbin. Bonus points is /boot.
For the memes:
sudo rm -rf /*
This deletes everything and is the most popular linux meme
The same “expected” functionality:
sudo rm -rf /bin/*
This deletes the main binaries. You kinda can recover here but I have never done it.
/usr/lib or /usr/lib64 or /lib (some distros) or /lib64
Some things (like hosts file) are in /etc. /etc mostly contains configs.
What is system32? Outdated 32bit binaries?
A weird catch-all folder for “most important Windows system stuff”. It’s not 32bit, just named like that in typical Windows fashion for backwards compatibility.
Would probably be
/usr
and/bin
, while some apps get installed to/opt
or even/local
or/var
Why in Linux, Software uses a particular version of a library? Why not just say it’s dependent on that library regardless of version? It become pain in ass when you are using an ancient software it required old version of newer library so you have to create symlinks of every library to match old version.
I know that sometimes newer version of Library is not compatible with software but still. And what we can do as a software developer to fix this problem? Or as a end user.
Because it’s not guaranteed that it’ll work. FOSS projects don’t run under strict managerial definitions where they have to maintain compatibility in all their APIs etc. They are developed freely. As such, you can’t really rely on full compatibility.
That’s the same on ANY platform, but windows is far worse because most apps ship a DLL and -never- update the damn thing. With Linux, it’s a little bit more transparent. (edit: unless you do the stupid shit and link statically, but again in the brave new world of Rust and Go having 500 Mb binaries for a 5 Kb program is acceptable)
Also, applications use the API/ABI of a particular library. Now, if the developers of the said library actually change something in the library’s behavior with an update, your app won’t work it no more unless you go and actually update your own code and find everything that’s broken.
So as you can understand, this is a maintenance burden. A lot of apps delegate this to a later time, or something that happens sometimes with FOSS is that the app goes unmaintained somewhat, or in some cases the app customizes the library so much, that you just can’t update that shit anymore. So you fix on a particular version of the library.
You sometimes can build software that will work with more than one version of a C library, but less and less software is being written that binds only to C libraries. The key topic you want to look up is probably “ABI stability”.
How the hell do I set up my NAS (Synology) and laptop so that I have certain shares mapped when I’m on my home network - AND NOT freeze up the entire machine when I’m not???
For years I’ve been un/commenting a couple of lines in my fstab but it’s just not okay to do it that way.
https://wiki.archlinux.org/title/Fstab#External_devices
looks like this will do it. no-fail and a systemd timeout
Aha, interesting, thank you. So setting
nofail
and a time out of, say, 5s should work… but what then when I try to access the share, will it attempt to remount it?Look up “automount”. You can tell linux to watch for access to a directory and mount it on demand.
This is also what I’d like to know, and I think the answer is no. I want to have NFS not wait indefinitely to reconnect, but when I reconnect and try going to the NFS share, have it auto-reconnect.
edit: This seemed to work for me, without waiting indefinitely, and with automatic reconnecting, as a command (since I don’t think bg is an fstab option, only a mount command option): sudo mount -o soft,timeo=10,bg serveripaddress:/server/path /client/path/
User login script could do it. Have it compare the wireless ssid and mount the share if it matches. If you set the entry in fstab to noauto it’ll leave it alone till something says to mount it.
Any word on the next generation of matrix math acceleration hardware? Is anything currently getting integrated into the kernel? Where are the gource branches looking interesting for hardware pulls and merges?
NixOS. I don’t get what it really is or does? It’s a Linux distribution but with ceavets or something
How do people not using Debian/Ubuntu follow along with tutorials when their package manager doesn’t have a package that’s in Apt?
Back in my slackware days I’d just convert other distros packages to the tgz format or compile the package and its requirements.
If the dependencies were really complex I’d draw a picture to help me understand them better.
I typically search the package name + fedora, it will probably tell me the alternative package that is in fedora.
Nowadays, I have moved to an atomic fedora distro, so I would severely limit the amount of package I install on my system for stability and security.
I think I only have two packages installed on my machine: fish, because it is the only popular shell that follows xdg dir; and a latex-like input method to use in slack.
I usually look at their GitHub or what have you to see if there are packages or instructions there. I have been able to solve most issues this way. Otherwise I see how much of a bitch it will be to compile from source. Depending what it is, I also check to see if there is a docker image instead.
My first step is usually to figure out whether the package should exist as a separate entity under Gentoo (which, for instance, doesn’t have separate dev packages). Then I check the overlay masterlist to see if there’s an unofficial package (which there often is).
If there is no package, I can package it myself (since I’ve been working with the same distro for years and can handle the basic packaging cases), install from source, get the .deb and apply alien or deb2targz and proceed from there, or give the whole thing up as a bad job.
I’m running Endeavour OS (KDE Plasma) and ran into a weird issue with my graphics. It’s like windows sometimes flicker and flight with each other, some fullscreen videos won’t play and just lock to a gray screen instead (e.g. in Steam, though YouTube is oddly fine), and most 3D games are super choppy and unplayable.
I’m not asking how to fix this, I just want to know how I start troubleshooting! I haven’t done anything special with my system, and I think the issue started after a normal pacman update. My GPU is a GeForce GTX 1060.
Any suggestions to get started? I don’t even know if the issue is Nvidia drivers, X, window manager, KDE, etc.
EDIT: The problem was Wayland. Fixed by logging in with X11 instead!
Start by checking what windowing system you’re using as its a fundamental part of problem solving. It’s a little confusing how to do this, the top answer in this Stack exchange thread works well.
If you’re running the latest KDE then you’ve almost certainly been moved to Wayland and that will be the source of your problems. Wayland and Nvidia drivers don’t work well together, and KDE have defaulted to Wayland in the latest release. I have had very similar issues to you with the move to wayland and have not been able to fix them - they’re too fundamental and depend on updates to wayland and/or Nvidia drivers.
I know you don’t want a solution but there isn’t one at the moment, so you’d be wasting your time. The solution is to log out, then on the log in screen select Plasma (X11) as your session and log in again.
Personally I have had to abandon KDE as I get a different set of problems in X11. I’m on OpenSuSE Tumbleweed so have little choice inrolling back to the previously functioning version of KDE - I’m using Cinnamon instead and contemplating switching to a different Linux distro, probably OpenSuSE Leap in favour of stability over cutting edge.
Meanwhile I have the latest KDE running on another device with AMD GPU without issue.
In terms of when it’ll be fixed, there is a change being made to Wayland which will effect how it and the Nvidia drivers interact (something called Explicit sync). It’s just been merged into wayland so presumably will appear downstream in the coming next few months in rolling distributions. There have been articles suggesting this is going to fix most problems but personally I think this is a little brave but fingers crossed.
Oof, yep, that’s all it was. I just fired up Elden Ring and it runs great under X11. Thanks a million!
I’d heard Wayland and Nvidia don’t play nicely together, but forgot KDE had officially made the switch. I’m sure I approved the install a while back but probably assumed it was all stable and compatible now. Guess that’s what I get for not reading the release notes!
Try switching to different versions of your graphics driver and/or kernel. Nvidia cards get really finicky about the version matchups, especially as they age. Try different combinations of the versions that are available via pacman, and maybe it’ll work. You may need to start keeping an eye on updates to your kernel and graphics driver to see if a new update fixes your issue. Welcome to life with an nvidia card. I bought an nvidia card once in 2013. By 2016 I had to start playing this game on upgrades. At one point, the graphics driver was causing kernel panics until I downgraded both and waited a few months. Very happy with AMD.
Thanks, I’ll try that. I figured an update would fix it by now (it’s been a few weeks) but maybe I do need to roll back.
And yes my other machine has an AMD card. This will be my last one from Nvidia since I’ve fully switched to Linux.
I installed Debian today. I’m terrified to do anything. Is there a single button backup/restore I can depend on when I ultimately fuck this up?
timeshift is pretty good, but bootable btrfs snapshots are even better
These have both saved my ass on numerous occasions. Btrfs especially is pretty amazing.
You want a disk imager like clonezilla or something. If you’re not ready for that just show hidden files and copy your /home/your_username directory to a usb or something. That’s where all your files live.
I ran Linux in a vm and destroyed it about… 5 times. It allowed me to really get in and try everything. Once I rana command that removed everything, and I remember watching icons disappear as the destruction unfolded in front of me. It was kind of fun.
I have everything backed up and synced so it’s all fine. Just lots of reinstalling Thunderbird, Firefox, re logging into firefox sync, etc.
Once I stopped destroying everything I did a proper install and haven’t looked back.
This will be my 7th year on Linux now. And I have to say, it feels good to be free.
Install everything from store, and you should be fine. If you see a tutorial being too complicated, it is probably not worth following. Set your search engine to past year and see if there are better tutorials.
You might also want to consider atomic distros, they are much harder to mess up, and much easier to restore.
No I’m doing it to learn self hosting, I’m doing the hard stuff on purpose
Oh! in that case may I suggest yachts with docker containers? https://yacht.sh/
Everything on my homeserver is directly installed on the server, keeping them up-to-date is pretty annoying, and permission control is completely non-existent.
Since want to do things the hard way, I believe this can also be a good opportunity to do things in the “better” way (at least IMO).
Ah now that does look promising, I had settled on portainer but this yacht program looks very noob friendly! I’ll install it today and check it out! Cheers!
Portainer are great too! But yacht seems to be specifically designed for self-hosting.
Short version: How do I install apps onto a different partition from the default in Pop_OS! (preferably from within the Pop Shop GUI)?
Long version: I have a dual boot with Windows and I shrunk my Win partition to install linux and eventually realized I wanted more space on the linux side so I shrunk my windows partition again. But Linux won’t let me grow the existing partition since the free space isn’t contiguous. Since I don’t want to reinstall everything, I just created a data partition and have been using that for Steam installs. But I am still running low so yeah, looking to move some apps and realized it doesn’t actually ask me where to install when I install. I saw this thread and figured I’d just ask.
You can move partitions so they are next to each other and then expand. The easiest way Ive found is to boot a love USB distro, since the partitions can’t be mounted when you do it. Open parted and you can resize and move around.
Backup before you do it!
This is the way. There is a GParted distro that you can boot from a USB-drive that will allow you to move the partition and expand it to take up the free space Windows left.
You should first install GParted to familiarise yourself a little with how the GUI looks. It’s relatively simple, definitely simpler than parted, but it doesn’t hurt to have a look around before doing it live.
It’s also good to note that everything you do in GParted needs to be applied before it’s actually done. You “cannot” accidentally delete a whole partition without actually hitting an apply button.
I definitely meant gparted in my reply. That’ll teach me to proofread better.
I use Kali Linux for cybersecurity work and learning in a VM on my Windows computer. If I ever moved completely over to Linux, what should I do, can I use Kali as my complete desktop?
Kali is a very bad choice as a desktop or daily driver. It’s intended to be used as a toolkit for security work and so it doesn’t prioritize the needs of normal desktop use in either package management, defaults or patch updates.
If you ever switched to Linux, pick a distribution you can live with and run kali in a vm like you’re doing now.
Think of it this way: you wouldn’t move into a shoot house, mechanics garage or escape room, would you?
Do I get new puzzles every week if I lived in a escape room?
Ok, it just seems funny to need to use a Kali VM when I’d already be on Linux, but no big deal I guess.
I used it as an installed desktop environment at a workbench in a non security context for a year. It was a pain in the butt in like a million ways.
Even when I used the tools kali ships with regularly I either dual booted or ran it inside a vm.
If you wanna understand why every time someone asks about using kali as a daily driver even on their own forums, a bunch of people pop up and say it’s a bad idea, give it a shot sometime.
Ha no worry, I believe all you guys now and wouldn’t do it, and would just use a VM. Thank you for the insight.
No never! Do not use Kali as main OS choose Debian, Fedora, RHEL (not designed for this use case) or Arch system
Guess you mean replicate your existing install from the VM.
- Backup your /home from the VM
- Save the output of
dpkg -l
to a text file and work with that, or use something like apt-clone https://packages.debian.org/search?keywords=apt-clone
From there, install Kali Linux, and restore the relevant parts.
Oh very cool thank you. In one way I meant more simply just if Kali is decent as a daily driver complete desktop, rather than just as a specialized toolkit.
Kali Linux is based on Debian, so I guess you’ll be fine.
Kali Linux is a pretty specific tool, it’s not suited for use as a daily driver desktop OS.
It is my understanding that Kali is based on Debian with an xfce desktop, so if you want a similar experience (same GUI, same package manager) in a daily driver OS, you can start there.
Short answer: no
Long aswer: Kali, as a desktop is just half broken debian with a theme and a bunch of bloatware preinstalled… Even if your host is linux, you should still run Kali in a VM.
I want to start with Btrfs and snapshots, is there a good, beginner friendly tutorial for those coming from a ext* filesystem?
If you try a distro that does it by default then it is no more complicated then ext4 for the user. The distro will setup things for you. I know that opensuse Tumbleweed and Fedora Workstation set this up by default. Manually configuring is how ever a bit more complicated.