Sponsored Content
Top Forums UNIX for Advanced & Expert Users Shell command to print full path to current home directory Post 303044734 by Chubler_XL on Monday 2nd of March 2020 09:42:12 PM
Old 03-02-2020
Do the commands realpath or readlink (with or without -f) help here at all?

Or perhaps the Cwd module from perl:
Code:
perl -MCwd -e 'print Cwd::realpath($ARGV[0])' /home/user_name

 

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
SYSTEMD-GPT-AUTO-GENERATOR(8)				    systemd-gpt-auto-generator				     SYSTEMD-GPT-AUTO-GENERATOR(8)

NAME
systemd-gpt-auto-generator - Generator for automatically discovering and mounting root, /home and /srv partitions, as well as discovering and enabling swap partitions, based on GPT partition type GUIDs. SYNOPSIS
/lib/systemd/system-generators/systemd-gpt-auto-generator DESCRIPTION
systemd-gpt-auto-generator is a unit generator that automatically discovers root, /home, /srv and swap partitions and creates mount and swap units for them, based on the partition type GUIDs of GUID partition tables (GPT). It implements the Discoverable Partitions Specification[1]. Note that this generator has no effect on non-GPT systems, or where the directories under the mount points are already non-empty. Also, on systems where the units are explicitly configured (for example, listed in fstab(5)), the units this generator creates are overridden, but additional implicit dependencies might be created. This generator will only look for root partitions on the same physical disk the EFI System Partition (ESP) is located on. It will only look for the other partitions on the same physical disk the root file system is located on. These partitions will not be searched on systems where the root file system is distributed on multiple disks, for example via btrfs RAID. systemd-gpt-auto-generator is useful for centralizing file system configuration in the partition table and making manual configuration in /etc/fstab or suchlike unnecessary. This generator looks for the partitions based on their partition type GUID. The following partition type GUIDs are identified: Table 1. Partition Type GUIDs +-------------------------------------+--------------------------------+--------------------------------------+ |Partition Type GUID | Name | Explanation | +-------------------------------------+--------------------------------+--------------------------------------+ |44479540-f297-41b2-9af7-d131d5f0458a | Root Partition (x86) | On 32-bit x86 systems, the first x86 | | | | root partition on the disk the EFI | | | | ESP is located on is mounted to the | | | | root directory /. | +-------------------------------------+--------------------------------+--------------------------------------+ |4f68bce3-e8cd-4db1-96e7-fbcaf984b709 | Root Partition (x86-64) | On 64-bit x86 systems, the first | | | | x86-64 root partition on the disk | | | | the EFI ESP is located on is mounted | | | | to the root directory /. | +-------------------------------------+--------------------------------+--------------------------------------+ |69dad710-2ce4-4e3c-b16c-21a1d49abed3 | Root Partition (32-bit ARM) | On 32-bit ARM systems, the first ARM | | | | root partition on the disk the EFI | | | | ESP is located on is mounted to the | | | | root directory /. | +-------------------------------------+--------------------------------+--------------------------------------+ |b921b045-1df0-41c3-af44-4c6f280d3fae | Root Partition (64-bit ARM) | On 64-bit ARM systems, the first ARM | | | | root partition on the disk the EFI | | | | ESP is located on is mounted to the | | | | root directory /. | +-------------------------------------+--------------------------------+--------------------------------------+ |993d8d3d-f80e-4225-855a-9daf8ed7ea97 | Root Partition (Itanium/IA-64) | On Itanium systems, the first | | | | Itanium root partition on the disk | | | | the EFI ESP is located on is mounted | | | | to the root directory /. | +-------------------------------------+--------------------------------+--------------------------------------+ |933ac7e1-2eb4-4f13-b844-0e14e2aef915 | Home Partition | The first home partition on the disk | | | | the root partition is located on is | | | | mounted to /home. | +-------------------------------------+--------------------------------+--------------------------------------+ |3b8f8425-20e0-4f3b-907f-1a25a76f98e8 | Server Data Partition | The first server data partition on | | | | the disk the root partition is | | | | located on is mounted to /srv. | +-------------------------------------+--------------------------------+--------------------------------------+ |0657fd6d-a4ab-43c4-84e5-0933c84b4f4f | Swap | All swap partitions located on the | | | | disk the root partition is located | | | | on are enabled. | +-------------------------------------+--------------------------------+--------------------------------------+ |c12a7328-f81f-11d2-ba4b-00a0c93ec93b | EFI System Partition (ESP) | The first ESP located on the disk | | | | the root partition is located on is | | | | mounted to /boot or /efi, see below. | +-------------------------------------+--------------------------------+--------------------------------------+ The /home and /srv partitions may be encrypted in LUKS format. In this case, a device mapper device is set up under the names /dev/mapper/home and /dev/mapper/srv. Note that this might create conflicts if the same partition is listed in /etc/crypttab with a different device mapper device name. Mount and automount units for the EFI System Partition (ESP) are generated on EFI systems. The ESP is mounted to /boot, unless a mount point directory /efi exists, in which case it is mounted there. Since this generator creates an automount unit, the mount will only be activated on-demand, when accessed. On systems where /boot (or /efi if it exists) is an explicitly configured mount (for example, listed in fstab(5)) or where the /boot (or /efi) mount point is non-empty, no mount units are generated. When using this generator in conjunction with btrfs file systems, make sure to set the correct default subvolumes on them, using btrfs subvolume set-default. systemd-gpt-auto-generator implements systemd.generator(7). SEE ALSO
systemd(1), systemd.mount(5), systemd.swap(5), systemd-fstab-generator(8), systemd-cryptsetup@.service(8), cryptsetup(8), fstab(5), btrfs(8) NOTES
1. Discoverable Partitions Specification https://www.freedesktop.org/wiki/Specifications/DiscoverablePartitionsSpec/ systemd 237 SYSTEMD-GPT-AUTO-GENERATOR(8)
All times are GMT -4. The time now is 02:48 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy