Questions tagged [directory-structure]

The layout of the directory hierarchy — questions like “where does this file belong?” or “what is this directory for?”.

Filter by
Sorted by
Tagged with
-1 votes
1 answer
36 views

Filesystem Hierarchy , private forensic analysis

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, ...
15 votes
2 answers
44k views

What's the right way to add directories to XDG_DATA_DIRS?

I've installed some app under /opt/myapp, which has a /opt/myapp/share directory. As I finish installing, it tells me: Note that '/opt/myapp/share' is not in the search path set by the XDG_DATA_HOME ...
0 votes
0 answers
19 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 ...
1 vote
2 answers
527 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
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 ...
167 votes
4 answers
143k views

Where should a local user executable be placed (under $HOME)?

I have an executable for the perforce version control client (p4). I can't place it in /opt/local because I don't have root privileges. Is there a standard location where it needs to be placed under $...
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 ...
219 votes
6 answers
264k views

Where do I put my systemd unit file?

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 ...
1 vote
1 answer
150 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 │   └── ...
107 votes
8 answers
272k views

Into which directory should I install programs in Linux?

I want to install a program in Linux and run it as a daemon. (Team Speak 3 in this case, but the question is general in nature). There is no package provided, only tarred binaries. Where in the ...
0 votes
2 answers
106 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 ...
629 votes
8 answers
467k views

What is the difference between /opt and /usr/local?

According to the Filesystem Hierarchy Standard, /opt is for "the installation of add-on application software packages". /usr/local is "for use by the system administrator when ...
141 votes
7 answers
282k views

What is /usr/local/bin?

Before today, I've used the terminal to a limited extent of moving in and out of directories and changing the dates of files using the touch command. I had realised the full extent of the terminal ...
0 votes
1 answer
48 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-...
1 vote
1 answer
1k views

How does IMAP physically store mails?

I am at last planning to move from POP3 to IMAP. I use maildir format to store mails and I want, at least for a short time, to keep a fallback route. I'm trying without success to find out how IMAP ...
9 votes
5 answers
24k views

Difference between “/export/home” and “/home”

In our UNIX machine my home path looks like /home/<userid> and we have another batch user whose home looks like /export/home/<userid> I want to know what's the difference between /export/...
-3 votes
1 answer
99 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 ...
6 votes
5 answers
2k views

how do I tell tar to only exclude a directory off of the root but not a directory with the same name deeper in the tree?

Folder structure: etc (dir) deploy (dir) src (dir) config (dir) dist ├- config (dir) ├- index.js What I'd like to do is pack up everything except the root config folder and place it in a tar in ...
0 votes
1 answer
84 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 ...
12 votes
3 answers
13k views

Linux File Versioning?

We are migrating from A VMS environment to a Linux environment for some old alpha servers we are decommissioning. The one challenge I have not been able to overcome is file versioning. VMS keeps ...
23 votes
1 answer
11k views

Why is /bin a symbolic link to /usr/bin?

According to the Filesystem Hierarchy Standard the /bin directory should contain utilities needed in single user mode. In practice, many Linux distributions make the directory a symbolic link to /usr/...
21 votes
4 answers
22k views

Standard location for holding software source files

Is there a standard location in Linux for holding source files for example OpenSSL. I am building Nginx from source with non default version of OpenSSL. I need to download and untar OpenSSL and I did ...
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
846 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
633 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 ...
10 votes
8 answers
13k views

directory structure vs file system

What is the difference between directory structure and file system? Unix/Linux directories and file system looks as follows: The following two directories obviously we know directories. /home/abc/...
1 vote
3 answers
184 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
253 votes
14 answers
361k views

Find the total size of certain files within a directory branch

Assume there's an image storage directory, say, ./photos/john_doe, within which there are multiple subdirectories, where many certain files reside (say, *.jpg). How can I calculate a summary size of ...
0 votes
1 answer
527 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 ...
4 votes
2 answers
6k views

How to use apps in '/opt' in a proper way?

I'm using Ubuntu 14.04 LTS. From time to time I copy some app (like xxx) to the /opt folder to be used also by another user-accounts. Then to start it I use: sudo /opt/xxx_folder/xxx (of course, ...
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() { ...
24 votes
2 answers
48k views

What are the files located in `/var/crash/`?

I know when a program crashes, some files creating in /var/crash/. But I don't know what these files are! Is that error logs?
0 votes
1 answer
251 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 ...
13 votes
4 answers
8k views

How to prepend a directory to files placed in a tar archive?

I want to tar the files foo and bar into a tar archive archive.tar, but I want them to appear, within the archive, as being within a directory, bazdir. Thus when I untar someplace I want bazdir to be ...
4 votes
1 answer
7k views

Where should be located a web application in Linux?

Here is an example of the file structure of a Linux distro: https://www.centos.org/docs/5/html/Deployment_Guide-en-US/s1-filesystem-fhs.html Each directory has a specific purpose, and seems like a ...
3 votes
1 answer
270 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 ...
2 votes
1 answer
439 views

How should I install software from source so that I can make my configuration manageable and reproducible?

I work with a lot of scientific software on Linux distributions (normally Debian variants and Red Hat variants). In order to maximize performance and get access to the latest features, it's often ...
27 votes
3 answers
53k views

find with -execdir

When I run find with -execdir I don't get the results I was expecting. For example: mkdir -p a/b/c find . -type d -execdir touch foo \; $ tree a a ├── b │   ├── c │   └── foo └── foo Directory c does ...
1 vote
1 answer
345 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
189 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, ...
150 votes
16 answers
59k views

Where should I put software I compile myself?

I need to compile some software on my Fedora machine. Where's the best place to put it so not to interfere with the packaged software?
11 votes
4 answers
11k views

How to find only directories without subdirectories? [duplicate]

Is there a way in linux to look through a directory tree for only those directories that are the ends of branches (I will call them leaves here), i.e., dircetories with no subdirectories in them? I ...
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 ...
16 votes
12 answers
89k views

How to recreate /var/lib/dpkg/status?

I have deleted some files around /var/lib/dpkg/, namely: /var/lib/dpkg/status /var/lib/dpkg/available /var/lib/dpkg/info/* I understand Debian uses these files to keep some information about ...
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, ...
41 votes
6 answers
5k views

What are the alternatives to the FHS?

I'm a long time Linux user for over 15 years but one thing I hate with a passion is the mandated directory structure. I don't like that /usr/bin is the dumping ground for binaries or libs in /usr/lib, ...
1 vote
2 answers
558 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 ...
53 votes
2 answers
155k views

Where to search for the core file generated by the crash of a linux application?

I am trying to find out the reason of crash for one of my Linux application. But I don't know where core is going. cat /proc/sys/kernel/core_pattern core.%e.%p Any Idea?
0 votes
1 answer
288 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 ...

1
2 3 4 5
10