Questions tagged [directory]

A file system structure in which to store computer files.

-4
votes
2answers
46 views

Forgot to put a slash before download path, where were these files downloaded to?

I forgot to put a slash before my home folder when downloading some files and it seems that they downloaded successfully but I can't seem to navigate before / within my thunar explorer so I can't get ...
0
votes
1answer
71 views

How do I write a shell script to flatten directories?

I wrote a simple script to delete useless files from a directory using the find command. Now I'm wondering if I can add lines to the script to flatten directories, but not completely flattened. e.g.,...
3
votes
1answer
345 views

Passing all files of specific filetype in current and subdirectories

I have constructed an elaborate 500+ character command with many arguments and switches to autosign multiple PDF documents. I'm using JSignPDF and I'd like to use it's batch mode including the ...
84
votes
7answers
64k views

The result of ls * , ls ** and ls ***

I know using the command ls will list all the directories. But what does the ls * command do ? I used it and it just lists the directories. Is the star in front of ls means how deep it can list the ...
2
votes
4answers
30 views

how to cut first 3 folders from this echo “/home/test/var/opt” ? i need the result “/home/test/var”

How to cut first 3 folders from a string? For example: echo "/home/source/Oracle/test" |cut -d'/' -f4 gives only one folder name, but I need up to the 3rd folder, like below: echo "/home/test/...
364
votes
8answers
252k views

Execute vs Read bit. How do directory permissions in Linux work?

In my CMS, I noticed that directories need the executable bit (+x) set for the user to open them. Why is the execute permission required to read a directory, and how do directory permissions in Linux ...
0
votes
2answers
21 views

User for group able to delete file even though the user has only read access to the file through group

I have a directory with the below permissions: drwxrwsr-x 3 john ro 20K Jun 20 14:48 logs I logged in as john and touched a new file inside logs: -rw-r--r-- 1 john ro 0 Jun 20 14:48 d From my ...
0
votes
0answers
28 views

Can tmpfiles.d remove only files but not directories based on time?

I want to empty /scandir/ of all files including files in sub directories but I don't want any directories themselves removed, which is what happening with the following in /etc/tmpfiles.d/test.conf: ...
3
votes
0answers
56 views

When coding for Unix/Linux is it convention to use a trailing slash on path names, or to omit it? [duplicate]

When programming for Unix/Linux, is it best practice to use a trailing slash, or to omit it? For example: Trailing slash baseDir="/path/to/dir/" #code# outPath=${baseDir}addition/to/path/ No ...
249
votes
4answers
397k views

How to set default file permissions for all folders/files in a directory?

I want to set a folder such that anything created within it (directories, files) inherit default permissions and group. Lets call the group "media". And also, the folders/files created within the ...
-2
votes
0answers
21 views

Directory's Data Usage in Ubuntu [closed]

Directory's disk usage list For indicated directory print a list of files and subdirectories in descending order according to their total disk usage. Disk usage of a simple file is equivalent to its ...
2
votes
2answers
34 views

authorize wheel group to rm in specific folder

I would like to authorize wheel group to rm in a specific folder (in this case my folder is "CT"). I've tried to add this line in visudo: %wheel All=(ALL) /bin/rm /CT/ I have a test files "test1" ...
12
votes
1answer
8k views

gpg: WARNING: unsafe ownership on homedir '/home/user/.gnupg'

System: I am testing Linux Mint 19 Beta based on Ubuntu 18.04. I got this warning while installing an unrelated package: gpg: WARNING: unsafe ownership on homedir '/home/vlastimil/.gnupg' This is ...
1
vote
2answers
50 views

Command for getting path to mount point of current partition/drive?

Is there an alternative command that does the same thing as findmnt -T . -o TARGET |tail -n 1? Example: If my current working directory is /media/username/HDD/subdir1/subdir2, that command would ...
1
vote
1answer
47 views

Tools to lock/encrypt folder in debian

Is there any tools to encrypt folder except encfs for debian?
106
votes
12answers
95k views

How to XZ a directory with TAR using maximum compression?

So I need to compress a directory with max compression. How can I do it with xz? I mean I will need tar too because I can't compress a directory with only xz. Is there a oneliner to produce e.g. foo....
51
votes
5answers
102k views

How do I remove all sub-directories from within a directory?

This question is kind of a phase II to the first question I posted at here I have a directory that contains a bunch of sub-directories, .zip files, and other random files not contained within a sub-...
0
votes
1answer
16 views

Explaining xargs output from two find commands

I have a directory structure of folder1 folder2 folder2a folder2b folder3 folder3a folder3b I am confused by the xargs output of the below command: XXXXXX:folder1 user$ find . -type d -...
13
votes
5answers
15k views

Move every file that is not a directory

I have a directory that I am trying to clean out that contains both files and subdirectories. What I am trying to do is simple: move all the files into another directory, but leave all the sub-...
0
votes
2answers
28 views

Copying diff results files

I have two folders - Folder A and Folder B. I compared the files from both folders using diff command. Now after finding that certain files are only available in Folder A and Certain files in Folder ...
1
vote
2answers
54 views

Why does `find -type d -exec rmdir {} \;` command produce “No such file or directory message”

For testing purposes, I created the following directories. user@linux:~$ mkdir dir0{1..3} user@linux:~$ ls -l total 12K drwxr-xr-x 2 user user 4.0K Mei 31 10:45 dir01 drwxr-xr-x 2 user user 4.0K ...
1
vote
1answer
42 views

What does it mean to open a directory in vim?

I did vim myDirectory, and got weird output that I don't know how to interpret.
0
votes
2answers
48 views

Compare two directories for a certain extension and then move the missing ones to a new directory [closed]

Editing and changing the verbiage to make it more clear - I have .dm4 files in both dirA and dirB. My reference folder is dirA and I want to list all the .dm4 files which are missing in dirA which are ...
0
votes
1answer
26 views

Default Directories Not Working In OpenSSL Configuration File

I have set the directory in the /etc/ssl/openssl.cnf file but every time I issue the command openssl req -x509 -newkey rsa:4096 -keyout cakey.pem -out cacert.pem -days 3650 it places the files in ...
10
votes
3answers
957 views

Remember “local” bash history in a folder?

I have a script in a folder that I use with long arguments. Is there any chance I can have an history of the commands executed in that specific directory instead of going back through the entire ...
0
votes
1answer
39 views

How to find duplicate directory paths even if the contents are different?

I've searched high and low but it seems all but one (Find and list duplicate directories) topic I've found actually deals with my situation, and the result isn't quite what I need. Edit: Here's some ...
0
votes
1answer
54 views

Restore function in unix

I have a script to recover files back to their original location. I am missing the options for the script to as "Do you want to recover this file?" Yes or No. How will I implement it into this code ...
10
votes
6answers
14k views

How do you check if a file exists within awk? [-d 'filename'] failing

I'm trying to generate a list of users who have a home directory set which does not exist. It seems I should be able to do this with awk, but something is wrong with my syntax. It keeps telling me "...
58
votes
7answers
82k views

rsync compare directories?

Is it possible to compare two directories with rsync and only print the differences? There's a dry-run option, but when I increase verbosity to a certain level, every file compared is shown. ls -alR ...
0
votes
2answers
2k views

move multiple directories in one directory - recursively

I have a directory which contains multiple directories including subdirectories too. I want to move some of them to a single one at the same time (with one command) Example Main Directory Sub1 ...
25
votes
9answers
3k views

Clipboard for copying and pasting files in command line?

In Bash, suppose I visit a directory, and then another directory. I would like to copy a file from the first directory to the second directory, but without specifying the long pathnames of them. Is it ...
1
vote
1answer
38 views

Shell script to test ls output for directories

I am trying to make a BASH script to test the files in the working directory and return the files that are directory files. One approach that I can think of is, starting with ls and feeding the ...
0
votes
2answers
57 views

Copy every 10 files from source into a target directory using cp

I have 110 large files inside a directory. But I cannot copy them at once since the system gets timed out after 50 min. I want to copy files 1 to 10, next 11 to 20, next 21 to 30, and so on. The order ...
7
votes
2answers
18k views

How to make a Desktop “shortcut” that opens the terminal but under a different directory than the default home?

Objective I am looking for an easy way to consistently run a terminal that automatically opens to a specific directory. Is there a way to do that without changing the default directory? Preferably I ...
1
vote
0answers
32 views

I have a directory of 110 large files. I want to copy them in the batch of n (e.g., 10) to aws s3 [closed]

I have 110 large files inside a directory. But I cannot copy them at once since the system gets timed out after 50 min. I want to copy files 1 to 10, next 11 to 20, next 21 to 30, and so on. The order ...
6
votes
1answer
227 views

The number of links for a folder doesn't reflect the real status?

A question for ls command. root@cqcloud script]# ls /var/www/html -la total 36 drwxr-xr-x 9 root root 4096 Aug 31 01:12 . drwxr-xr-x 7 root root 4096 Aug 31 01:10 .. drwxr-xr-x 2 root root 4096 ...
1
vote
0answers
24 views

Folders and files permissions for SDKMAN tool on Ubuntu

I am Java developer trying to set up my local CI server using Linux Mint. One of the crucial tools I would like to use is SDKMAN - the tool that allowes easy installation and management of different ...
0
votes
1answer
93 views

Nemo file manager is completely ignoring `_` at the beginning of directory name, when sorting

Ex. suppose some directories are named absorbing appreciate arrive connect depend drop few fold littlel popcorn shrill sticky In Windows, if I put _ before the directories, it would be at the top, ...
1
vote
1answer
41 views

Makefile - How to install a bash script into user's bin directory?

I need to make a Makefile to install a bash script into a user's bin directory, but I'm not sure what the best way of doing this would be. Should I be using a variable that accepts user input to ...
66
votes
6answers
35k views

Flattening a nested directory

This is probably very simple, but I can't figure it out. I have a directory structure like this (dir2 is inside dir1): /dir1 /dir2 | --- file1 | --- file2 What is ...
1
vote
0answers
31 views

How to restrict autocomplete for the files found from PATH?

What I would like to be able to do is to have a list of words that are allowed to be autocompleted when typing the first word in the command line. Say, I have PATH=/dir, and the directory /dir has ...
0
votes
2answers
15 views

.tar archive files EACH to its own directory?

I have an archive that contains files from various directories (created with -T option, so I used file with list of files to archive). Files preserve owners and rights. Content is like: var/lib/...
0
votes
0answers
32 views

Add trailing slash in csh

How do I get csh to add a trailing slash at the end of tab autocompletion? eg: \stuff \otherstuff now if I type cd s and press tab, I get: \stuff and not \stuff\
0
votes
3answers
33 views

How to list all directory paths including a text?

I need to list all directory paths including a text which is part of thier sub-directories. For example, the text is "tpcc" and I have two paths including tpcc as following: /home/arghy/sampledir1/**...
114
votes
7answers
45k views

What does the .d stand for in directory names?

I know many directories with .d in their name: init.d yum.repos.d conf.d Does it mean directory? If yes, from what does this disambiguate? UPDATE: I've had many interesting answers about what the ....
8
votes
3answers
22k views

What is the difference between path and directory?

I don't understand the difference between path and directory. Could someone explain to me with examples?
0
votes
0answers
37 views

How to map / mount a directory to another

I have two directories: /volume1/photos/ /volume1/shared_photos/ In shared_photos I have several sub-directories with pictures. What I want to do now is to "mount" or all the files from ../...
0
votes
0answers
23 views

A way to see your location history within the command line?

Similar to git's reflog, I'm looking for a way to see the directories I have moved through. I have lost something and I'm not sure exactly what happened, and something like the reflog is exactly what ...
7
votes
1answer
796 views

ls *.csv --ignore=“*pattern*” returns files which contain “pattern”

Why does ls --ignore not ignoring the pattern? Looking at the below example: mkdir books cd books touch books_abby.csv touch books_karen.csv touch books_david.csv touch books_tom.csv This creates ...
0
votes
2answers
25 views

List lastest modified or newly created files in linux

How to list modified or newly created files or directories in linux. So that I can trigger another command or shell script for another task. for eg. A file a.txt and test.txt are modified and I ...