Sample Header Ad - 728x90

Unix & Linux Stack Exchange

Q&A for users of Linux, FreeBSD and other Unix-like operating systems

Latest Questions

2 votes
1 answers
158 views
Is there a default or recommended directory to store source files ('configure', 'Makefile', etc) of *user* installs?
Suppose I have downloaded the source of some software I want to install *just for myself*, not system-wide; say Emacs or whatever. Typically the source is downloaded zipped, then it's unzipped in some directory. This directory contains files like "Makefile", "LICENSE", "configure", and so on. **Ques...
Suppose I have downloaded the source of some software I want to install *just for myself*, not system-wide; say Emacs or whatever. Typically the source is downloaded zipped, then it's unzipped in some directory. This directory contains files like "Makefile", "LICENSE", "configure", and so on. **Question: where should such a source directory be stored (for future check or use) within one's $HOME directory?** I checked the [XDG Base Directory Specification](https://specifications.freedesktop.org/basedir-spec/latest/) , but I don't manage to recognize any guidelines there – also because I'm a noob and I don't know if such files are considered "data files" or "state files" or other technical denomiations. A lot of (old) questions ask about where to install the local *executables*, for instance [this question](https://askubuntu.com/q/1148/1519798) or [this question](https://unix.stackexchange.com/q/127076/515980) or [this question](https://unix.stackexchange.com/q/316765/515980) (my system Kubuntu 24.04 confirms that ~/.local/bin is a good place, it's added to $PATH by default). Only [this question](https://unix.stackexchange.com/q/362642/515980) asks about the source files, but it seems to refer to system-wide ones, not local-user ones. It seems strange to me to have to save the source in system-wide /usr/src or the like.
pglpm (162 rep)
Aug 6, 2025, 08:52 AM • Last activity: Aug 6, 2025, 09:04 AM
7 votes
2 answers
757 views
~/.local/share is set for what? And can I ignore it at backups?
I wonder if `~/.local/share` contain real user data or if it only contain session-related data and binary generated stuffs. I also wonder if I can include it in an `--ignore` statement with [BorgBackup](https://www.borgbackup.org/) cause it really seams to not contain data or config files. Just some...
I wonder if ~/.local/share contain real user data or if it only contain session-related data and binary generated stuffs. I also wonder if I can include it in an --ignore statement with [BorgBackup](https://www.borgbackup.org/) cause it really seams to not contain data or config files. Just some kind of cache. So can I just ignore this directory and expect a pretty good recovery, or could it contain some real user-related data?
fauve (1529 rep)
Jun 17, 2025, 06:16 PM • Last activity: Jun 19, 2025, 11:34 AM
652 votes
8 answers
490743 views
What is the difference between /opt and /usr/local?
According to the [Filesystem Hierarchy Standard](https://www.pathname.com/fhs/pub/fhs-2.3.html), `/opt` is for "the installation of add-on application software packages". `/usr/local` is "for use by the system administrator when installing software locally". These use cases seem pretty similar. Soft...
According to the [Filesystem Hierarchy Standard](https://www.pathname.com/fhs/pub/fhs-2.3.html) , /opt is for "the installation of add-on application software packages". /usr/local is "for use by the system administrator when installing software locally". These use cases seem pretty similar. Software not included with distributions usually is configured by default to install in either /usr/local or /opt with no particular rhyme or reason as to which they chose. Is there some difference I'm missing, or do both do the same thing, but exist for historical reasons?
Patches (6862 rep)
Apr 18, 2011, 08:08 AM • Last activity: May 3, 2025, 07:10 AM
-1 votes
1 answers
36 views
package installation directories
When you automatically download and install packages through the apt or dpkg command , it installed in in a very detailed instructions(i mean perfectly in usr/share and usr/lib); i wanted to know : 1 . how the developers choose the directories and not simply put all of them in a folder;i know it's r...
When you automatically download and install packages through the apt or dpkg command , it installed in in a very detailed instructions(i mean perfectly in usr/share and usr/lib); i wanted to know : 1 . how the developers choose the directories and not simply put all of them in a folder;i know it's related to FHS but if you look at the picture below you see they have made a lot of symbolic links to another directories like you have symbolic links in usr/share/firefox-esr for usr/lib/firefox-esr and vice versa; enter image description here you see symbolic link points to somewhere else , or sometimes points to usr/share (though we could just put the file in the usr/lib); i know it's FHS but no where has any instruction to guide me to this level of complexity; if there is any instruction written somewhere or any book , would be happy to know the link.
Ramin (1 rep)
Mar 18, 2025, 01:12 PM • Last activity: Mar 18, 2025, 01:40 PM
112 votes
2 answers
130164 views
What is this new /run filesystem?
I just ran `df -h` a minute ago and noticed a filesystem has been added that I'm not familiar with. Does anyone know why `/run` exists? Is this something that's been added by the kernel? By [Arch Linux](http://www.archlinux.org/)? run 10M 236K 9.8M 3% /run
I just ran df -h a minute ago and noticed a filesystem has been added that I'm not familiar with. Does anyone know why /run exists? Is this something that's been added by the kernel? By [Arch Linux](http://www.archlinux.org/) ? run 10M 236K 9.8M 3% /run
xenoterracide (61203 rep)
May 28, 2011, 08:25 PM • Last activity: Mar 7, 2025, 03:12 PM
2 votes
0 answers
91 views
Ecryptfs : Decryption problem results in first level Question Marks when issuing 'ls -la'
I am sorry I did not find any related topic matching here. I have weird installation behaviour right after I installed my Linux Mint 22 in my existing partition table structure: * Luks Encrypted partition with LVM for root, user, swap * Boot Partition (none encrypted) * Dual Boot Windows partition *...
I am sorry I did not find any related topic matching here. I have weird installation behaviour right after I installed my Linux Mint 22 in my existing partition table structure: * Luks Encrypted partition with LVM for root, user, swap * Boot Partition (none encrypted) * Dual Boot Windows partition * One NTFS exhange partition The LUKS partition was during live sesssion opened, the inside lying LVM activated and mounted. All partition have been formatted besides the home partition with ecryptfsed home directories inside. Before Ubuntu 24.04 was installed as an mislead upgrade to 22.04 (mislead in terms of many small performance leaks and little errors, which do not end in a unusable but miserably configured system). A fresh install of Ubuntu 24.04 went wrong because it doesn't support LUKS and LVM during installation anymore. Damn. Then I started the installation assistant. All Went ok, performance increase like 200%, besides: * no HW sound device working (but existing) * initramfs does not activate LVM, no crypttab after second boot (then first looked) * backup home could not be decrypted properly (this ticket) ----------------------------------------------------------------------------- So in detail I can't open my backup home folder encrypted with the exakt same password like my user's id password and the one used for the homefolder: Alternate 1: ============
root# ecryptfs-private-recovery    # from somewhere
INFO: Searching for encrypted private directories (this might take a while)...
find: ‘/proc/38986/task/38986/net’: Invalid argument
find: ‘/proc/38986/net’: Invalid argument
find: ‘/proc/103650/task/103650/net’: Invalid argument
find: ‘/proc/103650/net’: Invalid argument
find: ‘/run/user/1000/gvfs’: Permission denied
find: ‘/run/user/1000/doc’: Permission denied
So ecryptfs is not finding any home directory (besides /home/user is a working decrypted one it is also not finding). Even when I start it from the directory .Private itself. I know - the encryption password - the algorithm AES - the key length 16 bit - encryption of file names is turned on - passthrough is no According to here and following from that answer here I was deleting the keys with (keyctl as a key management facility tool working with keyrings, but obviously not with the gnome keyring, the philosophy of the tool is unfortunately totally unclear as the whole ecryptfs tool (I did not find any sequence diagrams/uml charts on it):
$ sudo su
$ keyctl list @u
2 keys in keyring:
270246897: --alswrv  1000  1000 user: bbbbbbbbbbbbbbbb
996876983: --alswrv  1000  1000 user: aaaaaaaaaaaaaaaa
$ keyctl clean @u    [--> no keys available in
$ ecryptfs-unwrap-passphrase .ecryptfs/wrapped-passphrase
Passphrase: (enter your usual passphrase)
PPPPPPPPPPPPPPPP
(write down this unwrapped passphrase)
$ sudo ecryptfs-add-passphrase --fnek 
Passphrase: (enter the PPPPPPPPPPPPPPPP)
Inserted auth tok with sig [aaaaaaaaaaaaaaaa] into the user session keyring
Inserted auth tok with sig [bbbbbbbbbbbbbbbb] into the user session keyring
$ sudo mount -t ecryptfs /backup1TB/home_user_bck/.Private /backup1TB/home_user_bck/ -o key=passphrase:passphrase_passwd_file=/home/user/scripts/key.txt,ecryptfs_cipher=aes,ecryptfs_key_bytes=16,ecryptfs_passthrough=n,ecryptfs_enable_filename_crypto=y,ecryptfs_unlink_sigs
Filename Encryption Key (FNEK) Signature [aaaaaaaaaaaaaaaaaa]: bbbbbbbbbbbbbbbb
Attempting to mount with the following options:
  ecryptfs_unlink_sigs
  ecryptfs_fnek_sig=bbbbbbbbbbbbbbbb                     
  ecryptfs_key_bytes=16
  ecryptfs_cipher=aes
  ecryptfs_sig=aaaaaaaaaaaaaaaaaa
Mounted eCryptfs
* ecryptfs_fnek_sig and ecryptfs_sig are only shown hidden. As this home_backup directory was working as a mirror to my home directory both encrypted with ecryptfs with the same user password, it was tolerable for me to save the password plainly into scripts with 400 permissions. The log shows:
$ dmesg | tail
[469436.287197] ecryptfs_parse_tag_70_packet: Error attempting to find auth tok for fnek sig [d5459a9a6d6c7d8a]; rc = [-2]
[469436.287330] Could not find key with description: [d5459a9a6d6c7d8a]
[469436.287337] process_request_key_err: No key
[469436.287340] ecryptfs_parse_tag_70_packet: Error attempting to find auth tok for fnek sig [d5459a9a6d6c7d8a]; rc = [-2]
[469469.389865] Could not find key with description: [d5459a9a6d6c7d8a]
[469469.389884] process_request_key_err: No key
[469469.389889] ecryptfs_parse_tag_70_packet: Error attempting to find auth tok for fnek sig [d5459a9a6d6c7d8a]; rc = [-2]
[469469.389907] Could not find key with description: [d5459a9a6d6c7d8a]
[469469.389912] process_request_key_err: No key
[469469.389915] ecryptfs_parse_tag_70_packet: Error attempting to find auth tok for fnek sig [d5459a9a6d6c7d8a]; rc = [-2]
peddanet@HP-ENVY-Laptop-13-aq1176ng:/backup1TB$ ^C

$ journalctl -xe | grep
Mar 05 00:55:40 HP-ENVY-Laptop-13-aq1176ng sudo: peddanet : TTY=pts/3 ; PWD=/backup1TB ; USER=root ; COMMAND=/usr/bin/mount -t ecryptfs /backup1TB/home_peddanet_bck/.Private /backup1TB/home_peddanet_bck/ -o key=passphrase:passphrase_passwd_file=/home/peddanet/scripts/key.txt,ecryptfs_cipher=aes,ecryptfs_key_bytes=16,ecryptfs_passthrough=n,ecryptfs_enable_filename_crypto=y
Mar 05 00:55:40 HP-ENVY-Laptop-13-aq1176ng mount.ecryptfs: Error initializing key module [/usr/lib/x86_64-linux-gnu/ecryptfs/libecryptfs_key_mod_gpg.so]; rc = [-22]
Alernative way ============== According to this way for MINT I did the recovering right this:
/backup1TB/.ecryptfs/home_user_bck# ecryptfs-recover-private .Private;
INFO: Found [.Private].
Try to recover this directory? [Y/n]: Y
INFO: Found your wrapped-passphrase
Do you know your LOGIN passphrase? [Y/n] Y
INFO: Enter your LOGIN passphrase...
Passphrase: 
Inserted auth tok with sig [cccccccccccccccc] into the user session keyring
INFO: Success!  Private data mounted at [/tmp/ecryptfs.HR2cA03S].
# keyctl list @u
3 keys in keyring:
384278683: --alswrv     0     0 user: bbbbbbbbbbbbbbbb
351461027: --alswrv     0     0 user: aaaaaaaaaaaaaaaa
Errors: No errors! BUT: Outcome for both ways: ====================== It seems working properly, but ls -la will serve: Examining these directories as well as mounting with my passphrase, which works "top level" without errors, but you can't access these files and directories, it stops:
$ ll home_user_bck
ls: cannot access 'home_user_bck/.nuget': No such file or directory
ls: cannot access 'home_user_bck/lsix-master': No such file or directory
ls: cannot access 'home_user_bck/.mozilla': No such file or directory
[..]
ls: cannot access 'home_user_bck/ECRYPTFS_FNEK_ENCRYPTED.FWbJFNeOPKlxWUQHdX-EKzX72XJwQQKem-XJNDrYJBdx.UWXCIKeIOw45E--': No such file or directory
ls: cannot access 'home_user_bck/openvlc.tasks': No such file or directory
ls: cannot access 'home_user_bck/Screenshot from 2021-11-06 15-37-10.png': No such file or directory
[..]
ls: cannot access 'home_user_bck/.ecryptfs': No such file or directory
ls: cannot access 'home_user_bck/.thunderbird': No such file or directory
ls: cannot access 'home_user_bck/.xsession-errors': No such file or directory
ls: cannot access 'home_user_bck/thinclient_drives': No such file or directory
[..]
drwxr-xr-x 49 user user  20K Feb 20 12:47  .
drwxr-xr-x  6 user user 4,0K Feb 17 14:31  ..
d?????????  ? ?        ?           ?            ?  Audio
-?????????  ? ?        ?           ?            ?  backup.log
-?????????  ? ?        ?           ?            ?  .bash_history
-?????????  ? ?        ?           ?            ?  .bash_logout
-?????????  ? ?        ?           ?            ?  .bashrc
d?????????  ? ?        ?           ?            ?  bin
d?????????  ? ?        ?           ?            ?  .cache
d?????????  ? ?        ?           ?            ?  .conda
d?????????  ? ?        ?           ?            ?  .config
d?????????  ? ?        ?           ?            ?  .cups
d?????????  ? ?        ?           ?            ?  .cyberghost
[..]
d?????????  ? ?        ?           ?            ?  .dbus
d?????????  ? ?        ?           ?            ?  Desktop
d?????????  ? ?        ?           ?            ?  Documents
d?????????  ? ?        ?           ?            ?  Dokumente
d?????????  ? ?        ?           ?            ?  .dotnet
d?????????  ? ?        ?           ?            ?  Downloads'
-?????????  ? ?        ?           ?            ?  examples.desktop
d?????????  ? ?        ?           ?            ?  .gconf
-?????????  ? ?        ?           ?            ?  .gitconfig
d?????????  ? ?        ?           ?            ?  .gnome
d?????????  ? ?        ?           ?            ?  .gnupg
d?????????  ? ?        ?           ?            ?  .hardinfo
-?????????  ? ?        ?           ?            ?  index.html
d?????????  ? ?        ?           ?            ?  .java
d?????????  ? ?        ?           ?            ?  jd2
-?????????  ? ?        ?           ?            ?  key.txt
-?????????  ? ?        ?           ?            ?  .lesshst
d?????????  ? ?        ?           ?            ?  .local
d?????????  ? ?        ?           ?            ?  lsix-master
d?????????  ? ?        ?           ?            ?  .mozilla
d?????????  ? ?        ?           ?            ?  Music
l?????????  ? ?        ?           ?            ?  user
d?????????  ? ?        ?           ?            ?  Pictures
[..]
d?????????  ? ?        ?           ?            ?  scripts
d?????????  ? ?        ?           ?            ?  snap
d?????????  ? ?        ?           ?            ?  .ssh
-?????????  ? ?        ?           ?            ?  .sudo_as_admin_successful
d?????????  ? ?        ?           ?            ?  Templates
-?????????  ? ?        ?           ?            ?  test
d?????????  ? ?        ?           ?            ?  Test
d?????????  ? ?        ?           ?            ?  testdaten
-?????????  ? ?        ?           ?            ?  testdisk.log
-?????????  ? ?        ?           ?            ?  that.gif
[..]
I tried ecryptfs: ls lists top level folders but with "no such file or directory" for them but as ecryptfs-recover-private didn't find - no outcome. But similar results when it comes to listing top directory files. The lower directories are not possible to list. So what went wrong here? Could it be a weird different handling of ecryptfs formerly in Ubuntu 22.04 and now Linux Mint 22.1? Is the ecryptfs system inevitably corrupted? How can I detect, what else can I do? Obviously the slightes changes in above commands can result in totally hideous and hiding errors (or messages).... Annotations =========== ** The .ecryptfs was missing with the backup, so as it was a direct copy of /home/user back then, I just copied from the home/.ecryptfs/user/.ecryptfs to /backup1TB/.ecryptfs/home_user_backup/. In the folder /backup1TB/home_user_backup/ there were two links to .Privateand .ecryptfs to the formerly mentioned .ecryptfs folder.
pedda (81 rep)
Feb 17, 2025, 03:05 PM • Last activity: Mar 5, 2025, 12:02 AM
1 votes
1 answers
147 views
Debian 12 - Nautilus sorting order
I have a strange problem, I have had it since i installed Debian 12 Bookworm, earlier I was using Debian 8 Jessie and there was not this problem. Every time I open up Nautilus there is no default sorting, at least not show with arrow up or arrow down in the description bar. If i click '*name*' so it...
I have a strange problem, I have had it since i installed Debian 12 Bookworm, earlier I was using Debian 8 Jessie and there was not this problem. Every time I open up Nautilus there is no default sorting, at least not show with arrow up or arrow down in the description bar. If i click '*name*' so it sorts by '*name*' ASC, it works in the current folder I'm in, and it can work in next folder also, but some folder can be sorted DESC by '*name*' when I open. I was trying to browse before writing this post to try to find examples on this. When I open up Nautilus, the current directory will be '*/home/username*' with no sorting at least what I can figure, when I then press '*name*' it sorts the folders and files ASC and it shows folders first, like I want it. But when I then click on '*Downloads'* (*/home/username/Downloads*) it the sort by '*last_modified*'. And if I go into '*Documents*' it's sorting it by '*name*' but DESC. I start to go crazy by this, I want every folder to be sorted by '*name*' ASC. gsettings get org.gnome.nautilus.preferences default-sort-order 'name' And: dconf /org/gnome/nautilus/preferences/default-sort-order 'name' I have browser through the whole dconf, and I cannot seem to find any values that is relevant to the this problem. And one more problem I have is that it always show hidden files, even if the *'/org/gnome/nautilus/preferences/show-hidden-files'* is turned off.
BufferOverflow (353 rep)
Feb 13, 2025, 02:25 PM • Last activity: Feb 13, 2025, 03:34 PM
53 votes
5 answers
45274 views
Where in "/" should extra permanent disks be mounted?
According to Wikipedia http://en.wikipedia.org/wiki/Unix_directory_structure http://en.wikipedia.org/wiki/Filesystem_Hierarchy_Standard extra disks should not be mounted in `/mnt/` according to the first link, but doesn't seams so according to the second link. Both say thought that they shouldn't be...
According to Wikipedia http://en.wikipedia.org/wiki/Unix_directory_structure http://en.wikipedia.org/wiki/Filesystem_Hierarchy_Standard extra disks should not be mounted in /mnt/ according to the first link, but doesn't seams so according to the second link. Both say thought that they shouldn't be in /media. **Question** So where should extra permanent disks be mounted?
Sandra Schlichting (820 rep)
Jan 14, 2012, 03:38 PM • Last activity: Feb 11, 2025, 01:47 PM
233 votes
6 answers
315683 views
Where do I put my systemd unit file?
I [read][1] that there are two folders for unit files (not in user mode). /usr/lib/systemd/system/: units provided by installed packages /etc/systemd/system/: units installed by the system administrator Conflicting with this understanding is the answer to this question: [How to write startup script...
I read that there are two folders for unit files (not in user mode). /usr/lib/systemd/system/: units provided by installed packages /etc/systemd/system/: units installed by the system administrator Conflicting with this understanding is the answer to this question: How to write startup script for Systemd . Can someone fill in the missing information so that I understand what is going on? (**UPDATE: The answer has been updated, and my understanding no longer conflicts with it.**) Also, it seems that the scripts are organized in subfolders within the /etc/systemd/system/ folder: getty.target.wants multi-user.target.wants In another location I read that there are other locations. It seems these are for user-specific services. /usr/lib/systemd/user/ where services provided by installed packages go. /etc/systemd/user/ where system-wide user services are placed by the system administrator. ~/.config/systemd/user/ where the user puts its own services. ---- Update 2015-08-31: For the sake of others, here is a link to a related question I recently asked: Where do I put scripts executed by systemd units?
Jonathan Komar (7034 rep)
Aug 23, 2015, 08:11 PM • Last activity: Jan 28, 2025, 02:07 PM
10 votes
5 answers
24357 views
Difference between “/export/home” and “/home”
In our UNIX machine my home path looks like `/home/ ` and we have another batch user whose home looks like `/export/home/ ` I want to know what's the difference between `/export/home/ ` and `/home/ `? Why there are difference in folders when both are some user in UNIX?
In our UNIX machine my home path looks like /home/ and we have another batch user whose home looks like /export/home/ I want to know what's the difference between /export/home/ and /home/? Why there are difference in folders when both are some user in UNIX?
Vivek (203 rep)
Apr 20, 2011, 10:11 AM • Last activity: Jan 20, 2025, 09:39 PM
11 votes
1 answers
3834 views
What are the .Trash-500 and .Trash-1000 directories?
I have a DNS-321 NAS drive which apparently runs Linux, so I logged in via ssh and I see `.Trash-500` and `.Trash-1000` directories. I realize that they're for trash, but why do I need two? Inside of them I see `expunged`, `files`, and `info` directories -- what are those for?
I have a DNS-321 NAS drive which apparently runs Linux, so I logged in via ssh and I see .Trash-500 and .Trash-1000 directories. I realize that they're for trash, but why do I need two? Inside of them I see expunged, files, and info directories -- what are those for?
Stann (2209 rep)
Dec 3, 2011, 05:28 PM • Last activity: Dec 26, 2024, 03:47 PM
5 votes
1 answers
2043 views
How to organize /opt?
I'd like to place a handmade script in its conventional place and folder structure. It's currently located in `/opt/chkobm/chkobm`, but it seems like a bad practice since it requires `$PATH` to include wildcard paths (`/opt/*/`) From [TLDP][1] (section "Linux Filesystem Hierarchy"): > Programs to be...
I'd like to place a handmade script in its conventional place and folder structure. It's currently located in /opt/chkobm/chkobm, but it seems like a bad practice since it requires $PATH to include wildcard paths (/opt/*/) From TLDP (section "Linux Filesystem Hierarchy"): > Programs to be invoked by users are located in the directory /opt/'package'/bin. Firstly, is there a consensual rule about where to place such files ? (/usr/bin looks to me like a viable alternative place) Secondly, should I place handmade scripts to /opt/*/bin/ and export this path to $PATH ?
Sumak (273 rep)
Aug 27, 2020, 07:53 AM • Last activity: Dec 6, 2024, 12:37 PM
0 votes
2 answers
526 views
Where to put my own shell scripts and configuration files?
Could anybody explain, in which directory (or directories) I should place my own shell scripts and configuation files on macOS? - `/usr/local/bin/`? - `/usr/local/etc/`? - `$HOME/bin/`? - `$HOME/etc/`? - ... ? A best practice or a most common way? Example files are: - `webpage2pdf.zsh` - an ImageMag...
Could anybody explain, in which directory (or directories) I should place my own shell scripts and configuation files on macOS? - /usr/local/bin/? - /usr/local/etc/? - $HOME/bin/? - $HOME/etc/? - ... ? A best practice or a most common way? Example files are: - webpage2pdf.zsh - an ImageMagick script to convert a webpage to PDF - .webpage2pdf - a configuration file for it - .zshrc_my-own - a Zsh cofiguration file that is sourced in my ~/.zshrc using source, as suggested by Gilles to avoid accidental overridings: https://unix.stackexchange.com/a/787409
jsx97 (1347 rep)
Dec 1, 2024, 07:39 PM • Last activity: Dec 2, 2024, 12:52 AM
1 votes
1 answers
645 views
Why does find . not show all files
ls - list directory contents empty_dir# ls -al total 0 drwxr-xr-x. 2 root root 6 Dec 31 09:49 . dr-xr-x---. 6 root root 284 Dec 31 09:49 .. find - search for files in a directory hierarchy empty_dir# find .
ls - list directory contents empty_dir# ls -al total 0 drwxr-xr-x. 2 root root 6 Dec 31 09:49 . dr-xr-x---. 6 root root 284 Dec 31 09:49 .. find - search for files in a directory hierarchy empty_dir# find .
Justchoose1 (85 rep)
Dec 31, 2019, 09:27 AM • Last activity: Nov 19, 2024, 01:39 PM
2 votes
2 answers
128 views
How can I move all files matching a pattern into a new folder?
I have files like these : - REPORT_100_COMPLETED.csv - REPORT_100_FAILED.csv - REPORT_101_COMPLETED.csv - REPORT_101_FAILED.csv - REPORT_102_COMPLETED.csv - REPORT_102_FAILED.csv I want all of them to be put inside subfolder according to the related id : 100 | REPORT_100_COMPLETED.csv | REPORT_100_F...
I have files like these : - REPORT_100_COMPLETED.csv - REPORT_100_FAILED.csv - REPORT_101_COMPLETED.csv - REPORT_101_FAILED.csv - REPORT_102_COMPLETED.csv - REPORT_102_FAILED.csv I want all of them to be put inside subfolder according to the related id : 100 | REPORT_100_COMPLETED.csv | REPORT_100_FAILED.csv 101 | REPORT_101_COMPLETED.csv | REPORT_101_FAILED.csv 102 | REPORT_102_COMPLETED.csv | REPORT_102_FAILED.csv and so on, anyone can help? Thank you in advance!
nemuroito (23 rep)
Mar 31, 2021, 03:27 AM • Last activity: Nov 19, 2024, 11:12 AM
-2 votes
1 answers
93 views
A directory showing up in itself
I do `cd ~` and then `pwd`. It shows `/root`. Then I do `ls`. It again shows `root`. This is NOT another directory with the same name because when I do `cd root`, it says `-bash: cd: root: Not a directory`. Somehow, I have messed up something. **UPDATE:** The output of `ls -l ~/root` is: ```none -rw...
I do cd ~ and then pwd. It shows /root. Then I do ls. It again shows root. This is NOT another directory with the same name because when I do cd root, it says -bash: cd: root: Not a directory. Somehow, I have messed up something. **UPDATE:** The output of ls -l ~/root is:
-rw-r--r-- 1 root root 215040 Oct 15 10:01 /root/root
The output of ls -ld /root/root is:
-rw-r--r-- 1 root root 215040 Oct 15 10:01 /root/root
The output of file /root/root is:
/root/root: POSIX tar archive (GNU)
a_fan (123 rep)
Oct 15, 2018, 10:16 AM • Last activity: Nov 19, 2024, 11:07 AM
0 votes
2 answers
618 views
Recursively search directories for a filename, stop descending if found
I have a directory-tree which contains files with the same name, e.g.: ```bash a/file a/... a/b/file x/a/file x/a/... x/b/file ``` I'm trying to use `find` (with `-exec` and `-prune`) to get all paths where `file` occurs first when recursively searching the tree. My example would return: ``` a/file...
I have a directory-tree which contains files with the same name, e.g.:
a/file
a/...
a/b/file
x/a/file
x/a/...
x/b/file
I'm trying to use find (with -exec and -prune) to get all paths where file occurs first when recursively searching the tree. My example would return:
a/file
x/a/file
x/b/file
It does not return a/b/file because a file called file is already in a/. How can I achieve that with Bash?
Patrick B. (185 rep)
Feb 3, 2020, 06:08 PM • Last activity: Nov 19, 2024, 10:20 AM
4 votes
1 answers
332 views
How to limit "diff -r" to a certain depth?
How can I compare sub-directories in two directories down to a certain directory depth? Command `diff` doesn't have an option to specify depth, and `-r` option takes you all the way down to the files, which I want to avoid. Basically, I would like to do this: cd dir1 for d in */*/*; do test -d dir2/...
How can I compare sub-directories in two directories down to a certain directory depth? Command diff doesn't have an option to specify depth, and -r option takes you all the way down to the files, which I want to avoid. Basically, I would like to do this: cd dir1 for d in */*/*; do test -d dir2/$d || echo $d; done but more elegantly with a single command line and no loop.
Renat (141 rep)
Oct 11, 2022, 08:31 AM • Last activity: Nov 17, 2024, 09:35 AM
119 votes
9 answers
211957 views
Why is the root directory on a web server put by default in "/var/www"?
[Tuxfiles](http://www.tuxfiles.org/linuxhelp/linuxdir.html) says the following about the Linux directory structure: > `/var`: > > This directory contains variable data that changes constantly when the system is running. [FHS on `/var`][FHSvar] says the following: > `/var` contains variable data file...
[Tuxfiles](http://www.tuxfiles.org/linuxhelp/linuxdir.html) says the following about the Linux directory structure: > /var: > > This directory contains variable data that changes constantly when the system is running. FHS on /var says the following: > /var contains variable data files. This includes spool directories and files, administrative and logging data, and transient and temporary files. They then go on to say that things like logs, mail and the spooler are put in that folder. Traditionally A stock installation of Apache or Nginx or Arch on Ubuntu Linux will place the directory at /var/www/. It doesn't seem to me like the ideal place to put a directory with files or otherwise content that is supposed to be almost permanent. Why is it so often put into /var? More subjectively, is this where it should ideally go, according to the directory structure?
jonallard (1656 rep)
Sep 7, 2012, 05:27 AM • Last activity: Nov 6, 2024, 11:22 AM
0 votes
1 answers
70 views
command that display the directory and the files inside that directory like a tree
To get information about a directory we should use a certain command, so what command that display the directory and the files inside that directory like a tree in Linux? Thank you.
To get information about a directory we should use a certain command, so what command that display the directory and the files inside that directory like a tree in Linux? Thank you.
joe blood (11 rep)
Dec 13, 2020, 12:11 AM • Last activity: Oct 8, 2024, 02:41 PM
Showing page 1 of 20 total questions