To access the folders and files allocated to the user account, you begin with "~/". The use of "~" always signifies the path of "/home/$LOGNAME". This is the same as "/home/$USER", and the same as "$HOME", And initially, the same as $PWD. The "$" denotes a variable name follows, which is a string variable. Numerical values can be derived from a string by ${#VAR},where something like VAR=17 was done previously.
Note that on the left side of the equals sign, no $ preceeds the variable name. The
$PWD refers to the Present Working Directory.
Note that unlike Windows or DOS, there is only one current directory. With DOS or Windows, you have a current directory on every mounted drive. That's because with Unix and Linux, you have one continuous file system. What you have instead are mount points, where a device is mounted and becomes addressable. Mount points are be set up in folders, and the practice has been to set them up under /mnt, or more typically now, under /media. But to ensure only one user account has that device when mounted, the $USER or $LOGNAME becomes a subfolder under /media first.
Thus, If I am running Linux from the first partition on my internal drive, I am likely running off /dev/sda1. However, if the first partition got repartitoned or moved, I might be addressing this as /dev/sda5 or higher. This is much of the reason that the use of UUIDs is taking over, because each partition keeps the same UUID unless it gets reformatted. But while UUIDs are preferred for the fstab and grub2 processes. the manual mount and umount commands still deals with device names.
I don't mount or unmount /dev/sda1. Thats the start of my file system. the one known as root and marked with "/". But i might want to mount /dev/sda2 as well. and my user name is Don, then it's contents can be accessed via the mount point at /media/Don/sda2/. You can find all the environmental variables in your current shell from a terminal window with the simple command of "printenv". It's not that different from DOS and Windows use of the "set" command at a command prompt.
But you don't need either of these commands if you already know the environmental variable name that you want. in our case, let's assume that the Linux user got the gz file, opened it with the Archive Manager. and extracted it to the lowest folder he can legitimately get to via his account. It appears to him as the Home Folder, but is actually the same as the $HOME enironmental setting. And you can get there via the use of "~" as well. So he extrracts it here. The folder's name is "purebasic", all lower case, and case is important in Unix and Linux. So building the path is easy:
"~/purebasic/examples/sources/". This is the path you would normally assume would be there. But suppose it isn't. Let's assume that it is placed inside another folder somewhere. Is there a Linux too that would find it? Actually there are several, The first one you might think of using is "find". That's good for finding a file, but you might want to look for a portion of a directory tree, which cand be a better indicator of subfolders in subfolders with a specific file at the end of your search term.
For this type of search, the "locate" command is a better choice. Here is one I just used and the results obtained:
Code: Select all
locate purebasic/examples/sources/Data/ui.xml
/home/oldefoxx/Templates/purebasic/examples/sources/Data/ui.xml
/home/oldefoxx/purebasic/examples/sources/Data/ui.xml
There is perhaps a better way. Like DOS and Windows. a single period means the current directory, and a double period means the parent directory. You can use that info to do relative positioning. Or use the shell command "pwd" to find the actual path to the current directory. I wanted to compile a quick program to see what a RunProgram() and "pwd" would tell me, but this is the partition that currently has a problem with pbcompiler. I'll need to do that later. It's 6:16am and I need some sleep.