Questions tagged [directory-structure]
The layout of the directory hierarchy — questions like “where does this file belong?” or “what is this directory for?”.
472
questions
1
vote
2
answers
47
views
Where to install custom software packages on FreeBSD?
In Linux, according to the Filesystem Hierarchy Standard, /opt is the designated location for add-on application software packages. Thus, when developing my own software package, which is not a ...
0
votes
0
answers
33
views
What is the significance of lib, share and include? What to do with them?
I installed node.js using:
wget -q -nc --show-progress "https://nodejs.org/download/release/latest/node-v21.7.3-linux-arm64.tar.gz"
sudo tar -xvf node-v21.7.3-linux-arm64.tar.gz -C /usr/ --...
0
votes
1
answer
64
views
Why did Red Hat relocate Apache to /usr/sbin
I run Apache http servers on Red Hat and Oracle Linux machines. The account requires that only packages from the Red Hat or Oracle repositories be used. That’s fine , they work and are reasonably ...
-1
votes
1
answer
39
views
Filesystem Hierarchy , private forensic analysis [closed]
I wanted to refresh my memories and ran the command in the terminal
find / -mtime some_date -printf '%TY-%Tm-%Td %TT %p\n' 2>/dev/null | sort -r
and I see a large number of files, drivers, ...
0
votes
0
answers
20
views
How to uncompress two rar archives preserve content order?
How to uncompress two rar archives preserve content order? The archives is not .part1,.part2, just two separate archives containing video courses in folders. The folder names in first and second ...
0
votes
0
answers
38
views
20+ backup directories, I'd like to dedupe all files to 1 "master directory"
As the title suggests, I have inherited a file structure where there are about 30 "complete or partial backups" of a fileserver full of text files. This obviously makes no sense, and I'd ...
0
votes
0
answers
58
views
difference between folder/ and /folder [duplicate]
I have a small confusion regarding a basic thing in paths i.e whats the difference between folder/ and /folder
I just want to understand whats the difference between both. I tried to search but didn't ...
1
vote
1
answer
156
views
How to exclude different levels of subdirectories with cp?
This is a follow-up question to my original post: find & cp command doesn't copy 1st level directory
I have a directory structure like this:
test folders
├── 1
│ ├── 1-1
│ ├── 1-2
│ └── ...
0
votes
2
answers
121
views
Return all files of a specific extension with directory and subdirectories paths
using terminal on MAC OS I need to return path along with the file name in the a directory and all sub-directories, but only if a fie has a specific file extension (e.g. .txt).
I tried this, but it ...
0
votes
1
answer
50
views
What does "site-wide" mean?
I'm reading man hier, which says:
/etc
Contains configuration files which are local to the machine. Some larger software packages, like X11, can have their own subdirectories below /etc. Site-...
-3
votes
1
answer
110
views
cd command only working when I put the slash after the directory name
I am new to Linux and working through Dion's course for Linux+. I'm currently on Permissions and Sticky Bits, and have run into an issue I can't figure out.
The assignment asks to create a directory ...
0
votes
1
answer
90
views
Rename directory hierarchy
How can I rename directory hierarchy?
For example I want to rename c/d to x/y
There won't be necessary only 2 folders.
So the full directory path /a/b/c/d/e becomes /a/b/x/y/e after the operation.
Not ...
0
votes
1
answer
56
views
Can you turn an existing directory into a symlink without directly removing the directory?
There is an existing directory, say, dir. I want to remove it and create a symlink dir to another directory. So I know I can just do rm -rf dir and then ln -s /path/to/that/directory dir. Is there a ...
0
votes
2
answers
64
views
How to add subfolders from one directory to another directory with the same files unorganized, and prepend folder name to files
I am an R user who is not yet familiar with unix or command line coding. I have a directory with subfolders containing files, and I have another directory with all the same filenames and no subfolders ...
0
votes
1
answer
934
views
Write directories, subdirectories and file names to .txt file
I am looking for a command that will write the names of all directories, subdirectories and file names to a text file.
Example format:
directory1
|_subdirectory1
| |_filename1.mp4
|_subdirectory2
| |...
2
votes
1
answer
703
views
Which Linux directories should be used for python applications?
Until now I use pyenv to install python versions under a user name pydev in directory /home/pydev. I use the Debian package direnv to link the project directory with a python version installed using ...
1
vote
3
answers
205
views
How do I find the directory with the longest path?
How can I find the directory with the longest path (contains the largest number of subdirectories) , in the current directory , using ls ~ -R commmand
0
votes
1
answer
558
views
What's the idiomatic way of obtaining the "default" C++ include base path?
I'm building a command-line for some utility which, for some reason, needs the C++ include root, e.g. /usr/include/c++/10 (for libstdc++ of GCC-10). My question is: How do I determine what that path ...
0
votes
2
answers
43
views
Operate and output inplace results
I have a shell function which operates in-folder (in my case, it looks for *.eps` files and convert them to pdf without blank borders). Let us abstract this by the below function:
function do_here() {
...
0
votes
1
answer
315
views
Moving folder contents up 2 directory levels
I'm trying to write a command that uses mv to move files two directory levels up.
So if the folder order goes like this: ~/Test/2020-08-01/001/002/file.txt, I want to move file.txt from directory 002 ...
3
votes
1
answer
275
views
Why do we create custom partitions in Linux?
I am completely new in Linux and I installed centos VM in virtual box, at the time of installation I created partitions : /(root), boot, home and swap, so I thought that this is the same like in ...
1
vote
1
answer
379
views
How to move files in a directory based on a substring in filename
I'm very new to scripting and working in Unix/Linux systems, so I appreciate any help. I'm sure this has been answered before but I cannot figure out why none of the other solutions are working for my ...
3
votes
0
answers
192
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, ...
1
vote
2
answers
563
views
Is there a way to add a "description" field / meta-data that could viewed in ls output (or an alternative to ls)?
I have been using unix systems the majority of my life. I often find myself teaching others about them. I get a lot of questions like "what is the /etc folder for?" from students, and ...
0
votes
0
answers
19
views
Check which files in directory A are already contained somewher in directory structure B
I have a neatly organized folder structure with subfolders which contains jpegs (directory structure B). I also have several unorganized folders of jpegs (directory A).
I would like to delete all ...
1
vote
2
answers
583
views
How to move file contents deeper without copying
I have files in /home/jjblack/foo/. I want to move all the contents of this directory into /home/jjblack/foo/bar/.
I am unable to copy the contents elsewhere as there is not enough disk space. I am ...
0
votes
1
answer
290
views
How can i create sub directories within a directory? [closed]
I am trying to make a photo organizer with a zsh shell script. But i am having trouble creating sub directories within each main directory(based on date). Currently the script starts from a folder i ...
0
votes
1
answer
935
views
Move /var and /home directory on a separate NVME partition
I am using Debian 11
I would like to move /var and /home directories to a NVME partition nvme1n1p1 I have attached to the server.
EDIT: I am able to move the home folder and bind to the partition. But ...
0
votes
3
answers
139
views
How to copy all files with same extension between identical directory structures?
I have 2 independent folders A and B. B has many files with the extension .build. Across A there are a fe subdirectories that have the same structure as subdirectories of B.
For example A has ...
2
votes
1
answer
3k
views
$XDG_CACHE_HOME vs. $XDG_STATE_HOME
Based on the XDG Base Directory Spacifications, $XDG_STATE_HOME should store history and log of the programs. But it is very common to see UNIX programs storing these kind of stuff at $XDG_CACHE_HOME, ...
0
votes
1
answer
2k
views
Create a tar.gz file from a different directory, tar must keep files in specific directory structure
Here is my file structure. I am currently residing in test2/ directory, and all commands must run from there.
test/
|_test2/
publish/
|_subfolder1/
|_f1
|_f2
|_f3
|...
-3
votes
1
answer
133
views
What does 'cd ../..' mean in linux?
I am aware that cd is used to navigate between files in linux commandline. However, I am not sure what the following, that I came across while trying to replicate something, means:
cd ../..
It was ...
0
votes
1
answer
72
views
Find all files OR directories (without contents) that match a name
I'm trying to write a find command that searches for all files or directories with the name andreas in them (forward slashes added for clarity).
~$ find . -iname '*andreas*'
./Documents/Resume - ...
0
votes
2
answers
37
views
When looking at subdirectories, skip one directory
I have a directory /u01/oracle/folders with these subfolders:
[root@ricusesasctl01vm tax_receipts]# ls -ltr
total 64
drwxr-xr-x 5 OICDev1 oic 4096 Mar 1 2021 Argentina
drwxr-xr-x 5 OICDev1 oic 4096 ...
3
votes
0
answers
108
views
Is it reasonable to have a network-mounted home dir but a local ~/.cache?
I want to free up some space in my network-mounted home directory. I'm noticing that my .cache directory is very big. I was wondering whether I should replace it with a symlink, ~/.cache -> /...
0
votes
2
answers
89
views
What directory specifications need to be followed on servers?
On PCs, the XDG Desktop specifications allow the individual desktops to set different folders for various data. When writing an application that will only ever be run on servers, should one simply ...
27
votes
2
answers
20k
views
What is the difference between /lib and /usr/lib and /var/lib?
What is the difference between /lib and /usr/lib and /var/lib? Some of the files are symbolic links that "duplicate" content of other directories.
2
votes
1
answer
601
views
What is the correct place for driver sources?
I have some sources I want to compile using make. The sources will be compiled into a driver I'm going to use. What is the correct place for such files? /usr/share? /opt? /usr/local/...?
Edit: the ...
0
votes
1
answer
72
views
Inspecting two directory trees
How can I inspect two directory trees to determine if they are identical. Are there some good tools that allow tree merging that is free?
I am using Ubuntu Linux 20.04 LTS on an x86_64 architecture.
I ...
0
votes
1
answer
854
views
What's the most appropriate directory where to place development software shared between users?
About share data (files and directories) among users within the same machine, has sense use the /srv directory it according with:
What's the most appropriate directory where to place files shared ...
0
votes
1
answer
106
views
Opening file from sd card using dmenu
I would like to use dmenu to open files. I figured out how to get this to work if the file is in my home directory:
#!/bin/sh
FILE="workbook.pdf"
zathura "$FILE"
However, I ...
-3
votes
2
answers
1k
views
Why does every directory have "." and ".." dots? [duplicate]
A historical question. I tried searching for the answer to this, but no luck.
Every directory contains a "." and "..", even ROOT (/) contains "..", but why? Neither seem ...
1
vote
1
answer
280
views
What might be an equivalent to Linux /opt/ in OpenBSD?
In OpenBSD there is no /opt/, as there is with Linux.
From man hier in Ubuntu Server 18.04:
/opt This directory should contain add-on packages that contain static files.
What would be a ...
2
votes
2
answers
2k
views
DD command included directories
I'm learning the dd command in Linux. For test purposes, i initiated this command:
sudo dd bs=4M if=/dev/mmcblk0 of=/media/some_remote_host/stuff/myImage.img
I know that dd is for taking an image of ...
1
vote
2
answers
2k
views
What does mounting do in Linux and why do files appear in both /dev and /media after mounting?
I'm pretty new to Linux and I've been trying to understand how the file system works but I just can't seem to get what mounting is. I've seen several other questions on this site explaining but they ...
0
votes
0
answers
632
views
Rsync & MergerFS creating directories one by one
I have mergerfs setup with the default policy of epmfs. This means if I have local/target/ on all disks and copy files into local/target/, each file will get copied to the disk that has the most free ...
2
votes
1
answer
109
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 ...
0
votes
1
answer
109
views
True contents of a directory in a *nix system [duplicate]
I am learning about *nix file systems. In particular, I've been following this tutorial https://www.grymoire.com/Unix/Inodes.html interspersed with some Googling & whatnot. Is the true form of a ...
2
votes
1
answer
132
views
Figuring out why permission is denied on a file by recursively checking permission on parents
I get permission denied on a file /some/very/long/path while trying to do df on it.
I try to do df /some/very/long and get the same. Then I go one more level up df /some/very, still same.
Finally, ...
0
votes
2
answers
2k
views
merge multiple files in several subdirectories into 1 file for each subdirectory and delete original files
I have a directory structure
DIR
SUBDIR1
11-01-11.txt
13-05-23.txt
SUBDIR2
12-05-56.txt
13-04-02.txt
...