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 vote
1 answer
82 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 │   └── ...
anmac1789's user avatar
0 votes
2 answers
50 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 ...
Data Engineer's user avatar
0 votes
1 answer
41 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-...
robertspierre's user avatar
-3 votes
1 answer
56 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 ...
vinnymarz's user avatar
0 votes
1 answer
50 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 ...
ka3ak's user avatar
  • 1,235
0 votes
1 answer
47 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 ...
anonuser01's user avatar
0 votes
2 answers
63 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 ...
slund's user avatar
  • 1
0 votes
1 answer
580 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 | |...
linuxuser24569's user avatar
1 vote
1 answer
409 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 ...
SystemTheory's user avatar
1 vote
3 answers
148 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
bara's user avatar
  • 19
0 votes
1 answer
343 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 ...
einpoklum's user avatar
  • 9,187
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() { ...
Bruno Peixoto's user avatar
0 votes
0 answers
10 views

Sane location for policy-driven settings

In Windows, one can read/write application settings from a hierarchical database called the Registry. Conventially, there are four key places to write settings: HKEY_CURRENT_USER/Software/{Vendor ...
jimbobmcgee's user avatar
0 votes
1 answer
101 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 ...
LukeSmith's user avatar
3 votes
1 answer
212 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 ...
shank's user avatar
  • 31
1 vote
1 answer
250 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 ...
Melanie's user avatar
  • 11
3 votes
0 answers
147 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, ...
Renat's user avatar
  • 131
0 votes
1 answer
346 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 ...
BitWrecker's user avatar
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 ...
TorbenKorx's user avatar
1 vote
2 answers
425 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 ...
Jake's user avatar
  • 101
0 votes
1 answer
259 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 ...
Mathijs's user avatar
0 votes
1 answer
767 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 ...
Tapash's user avatar
  • 101
0 votes
3 answers
131 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 ...
Makogan's user avatar
  • 113
2 votes
1 answer
2k 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, ...
Rubem Pacelli's user avatar
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 |...
Dave's user avatar
  • 572
-3 votes
1 answer
126 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 ...
Sachin's user avatar
  • 97
0 votes
1 answer
69 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 - ...
IQAndreas's user avatar
  • 10.2k
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 ...
Indermohan Mokha's user avatar
3 votes
0 answers
92 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 -> /...
einpoklum's user avatar
  • 9,187
0 votes
2 answers
79 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 ...
Krateng's user avatar
  • 153
21 votes
2 answers
16k 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.
Huzi's user avatar
  • 352
2 votes
1 answer
397 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 ...
CIsForCookies's user avatar
0 votes
1 answer
67 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 ...
Vera's user avatar
  • 1,183
0 votes
1 answer
696 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 ...
Manuel Jordan's user avatar
0 votes
1 answer
93 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 ...
Joe Gerth's user avatar
-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 ...
Rucent88's user avatar
  • 1,870
1 vote
1 answer
247 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 ...
Paul's user avatar
  • 507
0 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 ...
Skywarth's user avatar
  • 115
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 ...
chikipichi's user avatar
0 votes
0 answers
573 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 ...
Chris Graham's user avatar
2 votes
1 answer
93 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 ...
nemuroito's user avatar
0 votes
1 answer
108 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 ...
Ryan Blanchard's user avatar
2 votes
1 answer
119 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, ...
shikhanshu's user avatar
0 votes
2 answers
1k 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 ...
sheth7's user avatar
  • 191
6 votes
2 answers
1k views

How to mirror directory structure and files with zero size?

I am trying to mirror the directory and file structure of a particular directory. However, I want the mirrored files to have no size. So for example, if I had the following directory tree: ...
Skeleton Bow's user avatar
0 votes
1 answer
258 views

What is convention on where to install cross-platform libraries?

What is the prevailing (or correct) convention on where to install cross-platform libraries? E.g. libfoo.so.1.0.0 compiled for the host might typically be located at /usr/local/lib/. If I also had to ...
StoneThrow's user avatar
  • 1,615
0 votes
1 answer
48 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.
joe blood's user avatar
0 votes
1 answer
262 views

Move specific file types in subfolder to destination folder but without loosing subfolder structure

first of all I have very limited knowledge in Linux but I am always trying my best. I also have already automated a lot of things in my Unraid Server and RPi by using Cronjobs and scripts, but now I ...
Daniel's user avatar
  • 1
0 votes
0 answers
114 views

Creating a chart of directory structure on a complicated Linux server

Im part of a development team for a certain server. Our project has a lot of old/legacy stuff, including code and design, and for this iteration at least it will remain like this. The server is Debian ...
John's user avatar
  • 187
1 vote
1 answer
275 views

Add directory to manpath based on users input

Using: Ubuntu 20.04.1 LTS Editor: Nano I am working on a small shell script for college and it needs to have menu with a range of options available to the user. One of the options is to "add a ...
Steven's user avatar
  • 11

1
2 3 4 5
10