Questions tagged [directory]
A file system structure in which to store computer files.
1,676
questions
0
votes
0
answers
19
views
Can we set user permission to create a file but not a subdirectory in a directory?
Is it possible to give permission to only create files but not a directory to a user in linux?
abc@xyz:~/temp$ touch a
abc@xyz:~/temp$ mkdir b
abc@xyz:~/temp$
I want mkdir b to fail but touch a to ...
1
vote
0
answers
29
views
How to create a shared folder between Linux and Windows?
How to create a shared folder between Linux and Windows?
If possible, do not use additional applications. If it's not possible, please tell me the app that can be used.
These are my previous steps:
...
0
votes
1
answer
20
views
Missing directory after move to a link
I have the following dir structure
zfs filesystem - /opt/test/tmp
zfs filesystem - /opt/data/
I have two directory links:
/opt/test2/_tmp -> /opt/test/tmp
/opt/test2/_tmp2 -> /opt/data
In /opt/...
1
vote
1
answer
36
views
Why do I have capacity in an empty folder?
Why do I have capacity in an empty folder?
I found a strange thing while I was developing after seeing the company's old project.
It was strange that the folder had a capacity of 36M, so I entered the ...
0
votes
2
answers
44
views
A directory that is owned by some non-superuser, but can't be deleted by them
Is it possible to create a directory that its owner can't delete? Let's say I have directory bar owned by user foo, and I'd like to create a subdirectory bar/baz, also owned by foo, such that:
foo ...
1
vote
0
answers
42
views
How merge two directories? [closed]
For example i have dirA, dirB - all with subdirectories. I want to merge dirA into dirB with "force" dirA. I tryied to use this
/usr/bin/rsync -avh --progress dirA dirB
But "force"...
1
vote
1
answer
31
views
How to list directories I have access to?
I don't know how to describe very well the situation. I don't have access to a directory, but I do have access to some stuff within that directory.
For example:
In /path
[me@pc path]$ ls
ls: cannot ...
0
votes
0
answers
20
views
Change to the same directory as the other pane in tmux
When there are two panes in a current window of tmux session, is there simple way to change to the same directory as that of the other pane?
--
I found the answer at https://superuser.com/a/911890,
...
0
votes
0
answers
20
views
Directory on external disk marked as an empty file
I've an external disk (FAT32) with a folder called archiwum where I keep all the photos and videos (kind a of a backup). Unfortunately when I connect the disk to my mac via USB it does not recognise ...
0
votes
1
answer
55
views
Finding a string in multiple folders that are in the same directory
I have a directory A that has multiple folders, and I want to find a string in those folders. How can I do it?
I have tried grep -rw string * in A, but it takes a lot of time.
0
votes
1
answer
27
views
For all zips, and unzip in working directory and maintains its structure
With this command
find . -name '*.zip' -exec unzip '{}' ';'
we find all zip files under . (directory), then unzip them into the current working directory,
However, the structure is gone.
/backUp/...
0
votes
1
answer
20
views
In bash, how do I delete child directories older than the date that another directory was created?
I can use the following command to delete child directories in a particular directory older than x number of days
find /path/to/base/dir/* -type d -ctime +10 -exec rm -rf {} \;
but how would I delete ...
1
vote
1
answer
120
views
What should dirname and basename be in this command?
With this command, we can recursively unzip archives in a directory and its sub-directories and remain its structure in the current working directory.
find ../backUp/ -name "*.zip" |
...
0
votes
0
answers
16
views
Recursive bind mount not working android x86 7.1.1
I have 3 directories: a, b and c. Directory 'a' contains the subdirectories '1' and '2', and these sud-directories both contain files 'foo' and 'bar'. Directory 'b' also has subdirectories with the ...
0
votes
1
answer
85
views
WSL Linux doesn't known directories on other partition exist - Help
Title explains it, I got a new installation of Linux on WSL and it doesn't see existing directories on my laptop. I'm not sure what the issue is, I've tried what was on the net to assess the issue to ...
1
vote
1
answer
122
views
How to bulk rename files/directories containing spaces?
How can you bulk rename many files and/or directories by replacing a
snippet f o o with b a r in the file/directory name?
For each suggested method, preferably answer the following questions.
Is it ...
0
votes
0
answers
34
views
Why doesn't creating file with echo work for remote directories in this script?
I aliased the following script:
#!/usr/bin/bash
if [[ -d "template.html" ]]; then
:
else
cp -n /home/$(whoami)/CS/Software/Pollen/template.html .
fi
/usr/bin/echo "#lang pollen
[...
0
votes
0
answers
49
views
How to move files and maintain directory structure
I need to move files from one place to another and keep the structure that the original directory has. The parameter for this file to be moved would be to have more than 365 days without access and ...
0
votes
3
answers
57
views
What would be a command to zip all folders in a directory
I have a few folders in a directory that I want to zip individually.
Root
-folder1
-folder2
into:
Root
-folder1.zip
-folder2.zip
-folder1
-folder2
What would be a command to ...
4
votes
2
answers
195
views
Should TMPDIR have a trailing slash?
In Unix/POSIX/Linux systems it's possible to set the temporary directory via the TMPDIR variable. Wikipedia references a specification by the Open Group mentioning this.
What this doesn't answer for ...
0
votes
0
answers
34
views
How to remove hardlink to /home created by timeshift?
After installing timeshift on Kali Linux, the same device/drive with a different name/path was created as seen in the system monitor under the File Systems tab:
Even after uninstalling timeshift, the ...
0
votes
0
answers
22
views
sftp directory-change shortcut
If sitting at an arbitrary unix desktop system and using sftp (e.g. OpenSSH as shipped by Debian) to contact another arbitrary system, is there any shorthand that can be used to switch to the same ...
0
votes
0
answers
36
views
the suggestions about restoring the directories under /var?
Terribly sorry for this basic question, I'm a newbie to the linux world.
Currently I have a RHEL 7.5 machine which should normally have the following stuff under /var directory: adm, cache, crash, db, ...
0
votes
1
answer
29
views
Setgid on a directory is not giving execute permission on the file within directory
I have created directory as following:
root@host [~]# mkdir mydir
root@host [~]# ls -ld mydir
drwxrwxr-x 2 test test 4096 Mar 2 19:36 mydir
root@host [~]#
Then I have changed the group ownership ...
1
vote
1
answer
29
views
Setting setuid on `mkdir` without making it as executable
I am setting setuid on mkdir without making it as executable.
chmod u+s /usr/bin/mkdir
chmod u-x /usr/bin/mkdir
[root@rhel-85 /]# ls -l /usr/bin/mkdir
-rwSr-xr-x. 1 root root 84664 Jul 9 2021 /...
0
votes
1
answer
47
views
Can't access directory from netns
I created a simple test netns :
sudo ip netns add test
Then I brought up the lo interface.
I'm currently in the home directory of user1, and by executing
sudo ip netns exec test ls -la
I see all the ...
1
vote
3
answers
77
views
Can one do the equivalent of "rm -rf targetdir && mv sourcedir targetdir" with one command?
There are a few ways to interpret the operation of "replacing one file with another", but the one I want to focus on here is the one that can be achieved with the command
mv /that/there/...
0
votes
0
answers
23
views
Log directories that users go to
Is there any way to log the directories that a user goes to?
For example as soon as the user jack goes to /home/jack/music/ there is a log that shows he went to /home/jack/music/.
1
vote
3
answers
89
views
How to find if a directory is having a symbolic link as well with any other names
lrwxrwxrwx. 1 oracle oinstall 10 Oct 14 03:47 abc -> xyz
drwxr-xr-x. 6 oracle oinstall 4 Oct 26 21:11 xyz
i want to find that xyz is having a symbolic link with name abc
1
vote
2
answers
132
views
bash + test if folder is empty but exclude files with a leading dot
We used the following approach in order to verify if a folder is empty:
[[ "$(ls -A /var/folder)" ]] && echo "not empty"
on /var/folder, we did the following:
ls -l /var/...
0
votes
0
answers
27
views
Directories which contain content display size 0 from 'ls -al'
When I execute lld in a directory which has been formatted, to operate as an Ext4 type, I noticed that I am incorrectly getting 0 directory sizes (alias lld='ls -d -l --color=always .*/ */') for ...
0
votes
0
answers
26
views
Equal sign as file name separator: are there any caveats? [duplicate]
Currently I have a recursive directory of files that looks like the following
foo_1/bar_1.txt
foo_1/foo_2/bar_2.txt
foo_1/foo_2/bar_2a.txt
foo_1/foo_2/foo_3/bar_3.txt
...
I need to use a bash script ...
1
vote
5
answers
154
views
Folder name most folder names starts with (excl. ./)
I've a list of folder and I'd like to know which folder name most folder names starts with.
Given this list of folders:
./
./.something
./unrelated
./Target.Dire ctoryName
./Target.Dire ctoryNameOther
...
3
votes
4
answers
117
views
How create many nested directories and defining the permission to all them in one command?
In Linux the following two commands work as expected:
mkdir -m 555 new_directory
mkdir -p a/b/c
But the following does not work as expected:
mkdir -m 555 -p a/b/c
the 3 directories are created but ...
0
votes
2
answers
475
views
Files having Input/output error: how to completely ignore them as if they don't exist
Due to hardware problems, there are some Input/output errors. Some of my hard disk sectors are bad.
# find . -name 'cpp-service.zip'
find: ‘./.cache/chromium’: Input/output error
find: ‘./.config/...
17
votes
2
answers
3k
views
Why doesn't rmdir work recursively?
rmdir deletes only an empty directory. To delete recursively, rm -rf is used.
Why doesn't rmdir have a recursive option? Logically, when I am deleting a directory, I want to use rmdir.
Given that rm ...
0
votes
0
answers
39
views
Zip -recursive direcotry and it start file
I am trying to zip a folder that contains others files and folder by getting as parameter the directory and the zip name. My script is in antoher folder than the one that I should zip (just a ..). I ...
0
votes
0
answers
93
views
Filesystem infinite loop
So I accidentially created an infinite loop by copying a parent folder into the current one and now it loops infinitely.
Is it safe to delete the folder?
Or how do I delete the looping directory ...
0
votes
5
answers
49
views
create custom globally accessible directory like the home directory
I would like to create a projects directory which I can access from everywhere like the home directory (~). E.g. the following should work (no matter the cwd)
cd projects
ls projects/project1
Any ...
1
vote
0
answers
42
views
Can't move or rename folder in git repo, permission denied, despite being 'drwxrwxrwx', and bareword [duplicate]
I'm using Windows Subsystem for Linux 1 (WSL1), I want to rename the folder my code downloads files to from 'resources' to 'downloads' so I can group my files that do the downloading under a '...
0
votes
1
answer
87
views
How can I create a checksum for a folder full of files that I am copying to another hard disk to verify it?
I am on a 2015 MacBook Pro and have just updated to OS 12.01 Monterey, and to zsh on terminal.
I am able to create a checksum for individual files using
shasum -a 256 (then drag in a file).
However, I ...
0
votes
1
answer
42
views
Uploading files, some of which are directories, into an empty GitHub repository
I have created a program in my personal computer and I want to upload all its files into an empty GitHub repository.
I cannot do so from GitHub GUI because some of these files are directories and ...
2
votes
2
answers
236
views
Tarring-gzipping only hidden directories (or files + directories)
Based on this, to tar all hidden files in the current directory one can use
ls -A | egrep '^\.' | tar cvf ./test.tar -T -
However, how can one tar only all hidden directories or all hidden directories ...
1
vote
1
answer
916
views
Problem with installing Realtek rtl8188eus driver for TP-Link TL-WN722N v2 WiFi adapter in Ubuntu 20.04
I'm new to linux. I'm using Linux Lite 5.2 OS (Ubuntu 20.04). While trying to install a Realtek driver for a TP-Link TL-WN722N v2 WiFi adapter using git clone https://github.com/aircrack-ng/rtl8188eus ...
0
votes
1
answer
329
views
What does the output `d?????????` in `ls -l` mean? [duplicate]
What is the situation why ls -l returns a list of subdirectories in the form below?
d????????? ? ? ? ? ? Subdirectory
A tree launched on that directory returns 0 directories, 0 files for ...
0
votes
1
answer
55
views
How to rotate all images 90 degrees in a directory and all sub-directories (using mogrify)?
I'm attempting to do as my question title indicates, here is my best attempt so far:
find . -name '*.jpeg' -exec mogrify -rotate 90 '*.jpeg' {} +
This seems to rotate the images in the current ...
1
vote
1
answer
76
views
Delete sub-directories based on matching information from column
I want to keep only those sub-directories that are present in the corresponding directory from CSV file.
The file structure looks something like this:
100_folder/
├── folder_11
├── folder_25
├── ...
0
votes
4
answers
1k
views
How to loop through all files in the current and sub directories to find a string? [closed]
Hi I am trying to loop through a directory and all its subdirectories to find the string 'foo' in all the files, for example. I then want to display the file names (including full path) of all files ...
0
votes
1
answer
113
views
How do I install a specific version of chromedriver on Debian 11?
I need to install a version of Chromedriver for Google Chrome 83, which is the version of Chrome I need for the github script I'm trying to run (https://github.com/banyous/quora-scraper).
I've already ...
1
vote
1
answer
28
views
Finding specific PNG images and renaming them
I have to find multiple files named logo.png in different subdirectories, and change their names to oldlogo.png, how do I do that?
I already have the beginning, finding the file (each logo.png file is ...