Sponsored Content
Top Forums UNIX for Advanced & Expert Users Shell command to print full path to current home directory Post 303044733 by LMHmedchem on Monday 2nd of March 2020 09:16:28 PM
Old 03-02-2020
Shell command to print full path to current home directory

Hello,

This is a bit of an odd question. Most commends like echo $HOME will just print /home/user_name . I have a system where /home is mounted in a directory that is not under / and is also not its own partition.

There is a partition that is mounted in fstab with,
Code:
# shared linux data partition, /home is here by a bind mount
UUID=a89334f7-59b7-4d04-b89b-a5a30c379644  /mnt/linux_data  ext4  defaults  1 2

The home directory is mounted using a bind mount,
Code:
# bind mount /home to directory to a directory on /linux_data
/mnt/linux_data/01_centos  /home   none  bind   0 0

If I click on the home directory icon in dolphin, the location bar indicates /home/user_name as I would expect. Under the hood, this directory should actually be the directory /mnt/linux_data/01_centos/user_name which does exist in that location. I can navigate to /mnt/linux_data/01_centos/user_name by going through the /root icon in dolphin but I would like some means to print the full path to what the OS believes to be /home .

I am having some issues getting dolphin to display the rest of the partition that /home is mounted on and I would like to start by confirming that /home is where I think that it is. Am I making any sense at all???

LMHmedchem
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

home directory in search path

Is it unsafe to put your own home directory (a regular user) in your search path? I am writing useful shell scripts, but don't have the permissions to put them in /usr/bin. (Korn shell) thanks (2 Replies)
Discussion started by: jpprial
2 Replies

2. Shell Programming and Scripting

want the current directory without the absolute path

Hi guys I'm trying to move an empty directory to the $TRASH directory. Say the directory i have is ./hello/hello1/hello2 and i'm in hello2, and i want hello2 moved. this code: TRASH=$home/deleted find "$TRASH/$1" -type d -exec rmdir { } \; 2>/dev/null mv -f $1 $TRASH 2>/dev/null works... (2 Replies)
Discussion started by: olimiles
2 Replies

3. Shell Programming and Scripting

Sorting by Full directory path

I have a text file with full list of files with their full path. I wanted to sort it by directory then files then subdirectory by alphabetically. When I used the sort command it doesn't give like what I want. Could somebody help me on this. Here is the ex: This is what I'm getting... (2 Replies)
Discussion started by: javidraaj
2 Replies

4. Shell Programming and Scripting

Retrieve directory path from full file path through sh

Hi, I have a file abcd.txt which has contents in the form of full path file names i.e. $home> vi abcd.txt /a/b/c/r1.txt /q/w/e/r2.txt /z/x/c/r3.txt Now I want to retrieve only the directory path name for each row i.e /a/b/c/ /q/w/e/ How to get the same through shell script?... (7 Replies)
Discussion started by: royzlife
7 Replies

5. UNIX for Dummies Questions & Answers

Present Working Directory (not the full path)

Hi, Is there a command that tells you right away the current working directory? I know the command "pwd", but that one gives the full path. if pwd gives me: /a/b/c/d/ggg/HERE I want something that will give me: HERE Thanks, Gaurab (13 Replies)
Discussion started by: gaurab
13 Replies

6. Shell Programming and Scripting

How do I get an ls -l to not show the full directory path?

Hey I'm new to the forums here, and I'm seeking help for this script that I'm writing. When I do ls -l of a directory it shows the full pathname for files in it. For example, if the directory is /internet/post/forum/ and the file is topic, it currently shows internet/post/forum/topic. What's the... (3 Replies)
Discussion started by: unity04
3 Replies

7. Shell Programming and Scripting

$0 doesn't have full directory path

I'm running AIX unix korn shell. If I echo $0, I only get the filename, it does not have the directory name also. So when I do: `dirname $0` it returns a . (meaning current directory). How get $0 to return the full path/filename? Do I need something in my .profile? Thank you. (8 Replies)
Discussion started by: sboxtops
8 Replies

8. UNIX for Dummies Questions & Answers

How to get the current directory Path?

How to get the current directory Path in your prompt? i am getting a $ mark only in my prompt? Please help me with this (3 Replies)
Discussion started by: Abhishek0683
3 Replies

9. UNIX for Dummies Questions & Answers

Extract directory name from the full directory path in UNIX using shell scripting

My input is as below : /splunk/scrubbed/rebate/IFIND.REBTE.WROC.txt /splunk/scrubbed/rebate/IFIND.REBTE.WROC.txt /splunk/scrubbed/loyal/IFIND.HELLO.WROC.txt /splunk/scrubbed/triumph/ifind.triumph.txt From the above input I want to extract the file names only . Basically I want to... (5 Replies)
Discussion started by: IshuGupta
5 Replies

10. Linux

How to print full path name along with file extension?

Hi I have a requirement like this: /abc/a/x.txt /abc/a/y.txt /abc/b/x.gz /abc/b/y.txt I need output like this: /abc/a:*.txt /abc/b:*.txt /abc/b:*.gz I have tried find /abc -type f -name "*.*" ||awk -F . '{print $NF}' it is print only extensions without path name. Please... (5 Replies)
Discussion started by: lijjumathew
5 Replies
HMOUNT(1)						      General Commands Manual							 HMOUNT(1)

NAME
hmount - introduce a new HFS volume and make it current SYNOPSIS
hmount source-path [partition-no] DESCRIPTION
hmount is used to introduce a new HFS volume. A UNIX pathname to the volume's source must be specified. The source may be a block device or a regular file containing an HFS volume image. If the source medium is partitioned, one partition must be selected to be mounted. If there is only one HFS partition on the medium, it will be selected by default. Otherwise, the desired partition number must be specified (as the ordinal nth HFS partition) on the command- line. Partition number 0 can be specified to refer to the entire medium, ignoring what might otherwise be perceived as a partition map, although in practice this is probably only useful if you want this command to fail when the medium is partitioned. The mounted volume becomes "current" so subsequent commands will refer to it. The current working directory for the volume is set to the root of the volume. This information is kept in a file named .hcwd in the user's home directory. If the source medium is changed (e.g. floppy or CD-ROM disc exchanged) after hmount has been called, subsequent HFS commands will fail until the original medium is replaced or a different volume is made current. To use the same source path with the different medium, reissue the hmount command. EXAMPLES
% hmount /dev/fd0 If a Macintosh floppy disk is available as /dev/fd0, this command makes the floppy current for other HFS commands such as hls(1), hcd(1), hcopy(1), etc. % hmount /dev/sd2 1 If a SCSI disk is available as /dev/sd2, this command finds the first HFS partition on the medium and makes it available for other HFS operations. NOTES
hmount does not actually mount an HFS partition over a UNIX directory in the traditional mount(8) sense. It is merely a "virtual" mount, as a point of convenience for future HFS operations. Each HFS command independently opens, operates on, and closes the named source path given to hmount. SEE ALSO
hfsutils(1), hformat(1), humount(1), hvol(1) FILES
$HOME/.hcwd AUTHOR
Robert Leslie <rob@mars.org> HFSUTILS
08-Nov-1997 HMOUNT(1)
All times are GMT -4. The time now is 03:31 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy