A file system structure in which to store computer files.

learn more… | top users | synonyms

7
votes
3answers
703 views

How can I cd to the previous/next sibling directory?

I often have a project directory layout like this project `-- component-a | `-- files... `-- component-b | `-- files... `-- component-c `-- files... I'll usually be working in one of the ...
5
votes
2answers
66 views

Remove Linux directories containing ONLY old files

We have numerous directories that each contain 2 files, one of which is a hidden file. We want to remove all those directories and their contents that contain ONLY files that have a modification date ...
13
votes
5answers
15k views

Script to monitor folder for new files?

How do I detect new files in a folder with a bash script? I would like to process the files as soon as they are created in the folder. Is this possible to do so or do I have to schedule a script with ...
5
votes
2answers
197 views

How does one create a directory that can't be seen and can only be accessed via its absolute path name?

I'm working on an assignment on adding time support to a standard UNIX system. Part of it, however, involves securing the location of backup files (which we've set to be at the system root by default) ...
3
votes
1answer
37 views

Where does ext4 store directory sizes?

Where does ext4 store directory sizes? Are they stored in the directory inode? For example, when I run du -h, it returns directories' size instantly, so I don't believe it calculates it at that time. ...
7
votes
6answers
600 views

Is it possible to remove folder prefix from a `ls` command

I am in a bash script and I want to get the list of all files (let say all jar files). I execute the command ls -1 lib/*.jar and I get the output: lib/mylib_1.jar lib/mylib_2.jar ... Is there any ...
16
votes
6answers
2k views

Why do I have to cd out of a deleted directory?

On my server I have a directory structure looking something like this: /myproject/code I normally have an ssh connection to the server and 'stand' in that directory: root@machine:/myproject/code# ...
1
vote
2answers
41 views

Create an user that can only connect to a specific directory

I've created a SSH folder for some friends. I've created the users to log in via SSH, but they connect to ~ how can I set to which folder they can connect? I have a directory called /usbdrv/ which ...
2
votes
1answer
56 views

inotifywait not working when folder is deleted and re-created

I am trying to use inotifywait to monitor a folder: inotifywait -m -r /home/oshiro/Desktop/work_folder The command works and if I create files in that folder, all seems to work correctly. While ...
-1
votes
2answers
39 views

How to delete a directory from terminal?

I'm trying to delete a directory after a series of events take place. That being said, I need to be able to place this in a file to execute once said events take place.
0
votes
2answers
78 views

LINUX: How to calculate recursively the size of each sub directory up to root directory?

I have written this script Scrit in Linux. I now need to know the size for each sub directory with the condition -atime +${DAYS} searching down from directory $DIR. The result should be gathered in ...
1
vote
1answer
52 views

List files, directories and executables in current directory

I have php shell and I have function that do just that (but it give me error when I call scandir($path) function because of restriction in php), so I need to use my bash shell to do the same. It can ...
2
votes
1answer
44 views

Open multiple directories in different tabs in the same window in CentOS

How can I set my CentOS to be able to open multiple directories in different tabs in the same window? I have already enabled the feature to open the folders in the same window, but this is different: ...
0
votes
0answers
28 views

Mount a dropbox directory without installing the dropbox application

This is most likely to be a duplicate question, but I could not find a simple answer for my problem. My situation is as follows: I have multiple accounts on different computing clusters. I want to ...
2
votes
2answers
234 views

I can not remove folder from server

Accidentall I created the folder on remotely server (Server OS is Linux) using php: mkdir("folder_name",0); Now I can not delete this folder from server. I think this is from permission, because 0 is ...
1
vote
2answers
95 views

What is ~/default used for? [closed]

When I connect to my server using a the shell provided by Capistrano it executes ~/default before every command. I can't find out if this is Capistrano related or if this file has some generic use ...
0
votes
1answer
4k views

enable apache mod rewrites to load clean-urls

In CentOS, a2enmod rewrite results in “command not found” but httpd -M lists rewrite module as listed and shared. I'm trying to enable it so can then have these rewrite rule apply so I can switch back ...
2
votes
2answers
20 views

Symlink all subdirectories in a directory to another directory

I'm trying to symlink every directory in a folder to another folder. For example, in the structure below, I need the subfolders symlinked to folder2. - /home/chris/folder1 -- subfolder1 -- subfolder2 ...
5
votes
3answers
94 views

extracting to a directory other than the current directory with pax archiver

I have a strange behaviour with the pax archiver here, had too much troubles with tar and it's absolute path, that's why I gave pax a shot. The below oneliner is used under FreeBSD 9.2 to extract ...
32
votes
6answers
3k 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 ...
3
votes
1answer
107 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 ...
4
votes
6answers
16k views

How to remove all the files in a directory?

I am trying to remove all files and subdirectories in a directory. I used rm -r to remove all files, but I want to remove all files and subdirectories, excluding the top directory itself. For ...
1
vote
2answers
37 views

moving files of certain formats from subdirectoris to directories with same folder names

I’ve got a weird situation. I have 100s of folders with flac and mp3 copies of the same tracks. I need to separate the mp3s from the flacs and put them into similarly named directories. for example: ...
21
votes
3answers
5k views

Why unix mv program doesn't need -R (recursive) option for directories but cp does need it?

This is a kind of "wtf?" question, so I'm sorry if I will disturb someone's vision of how things should be or if I will just annoy you with the "stupid" question. I always get messed up when need to ...
6
votes
1answer
46 views

Expected behavior of `find -depth` if execute permission denied for subdirectory?

I'd like to know if I can rely on the behavior I am seeing when using find with -depth option and user does not have execute permission for a subdirectory. Assume the following directory structure: ...
7
votes
4answers
4k views

How can I force unzip / zip not to create a subdirectory when I extract it?

Depending on how a zip file is created, sometimes it will extract all of the files directly, and sometimes it will extract the files into a subdirectory. If the latter is true, how can I force the ...
1
vote
1answer
45 views

cp /etc/DIR_COLORS ~/.dir_colors not responding

I'm using CentOS 6.5 and Putty. My problem is that directory file names are shown in dark blue color which is hard to read. I google searched and found this link; basically it's copying the DIR_COLORS ...
4
votes
4answers
301 views

How can I use locate only for a directory

This finds a large number of files that are under various subdirectories of "Dropnot" $ locate Dropnot Can I find just the directory location with locate? (which directory "Dropnot" is in) So if ...
2
votes
4answers
55 views

Wrapper command that runs program in temporary directory and deletes it after execution [duplicate]

I want to write a command that: takes another command as its arguments does a 'cd' to a temporary folder executes the command passed in the arguments removes the temporary folder afterwards ...
0
votes
2answers
415 views

Remove soft link but not the target

I have a directory that contains a link to another directory that I just created. I would like to remove the link but preserve the directory my link was pointing to. How do I do this? > mkdir rgac ...
1
vote
1answer
30 views

Find which directories each group can access

I need to take the /etc/group file (RHEL) and check what high level subdirectories each group has access to. Here is a made up example: Group 100 - \xxx\xxx\xxx Group 150 - \xx\xxxxx\x Is that ...
3
votes
3answers
218 views

Transform a directory into file or a file into directory

I wanted to create a file named test. Accidentally I run mkdir test instead of touch test. Is it possible to convert test directory in a file named test? What about converting a file named test into ...
4
votes
2answers
353 views

Where is a shell script run from?

I have a shell script in /usr/bin. Let's call it hello. It contains this: echo "I am located in $PWD" echo "I am called from this directory: ???" Running hello from /home/Documents I expect the ...
2
votes
5answers
1k views

Get the newest file from directory structure year/month/date/time

I store backups of databases in a directory structure year/month/day/time/backup_name an example would be basics_mini/2012/11/05/012232/RATIONAL.0.db2inst1.NODE0000.20110505004037.001 ...
9
votes
4answers
33k views

“Input/output error” when accessing a directory

I want to list and remove the content of a directory on a removable hard drive. But I have experienced "Input/output error": $ rm pic -R rm: cannot remove `pic/60.jpg': Input/output error rm: cannot ...
-2
votes
2answers
29 views

How do I list lhe file permissions of only the current directory? [duplicate]

ls -la . will show this in it: insgesamt 1312 drwxrwxr-x 6 ruben rubo77 4096 Feb 23 06:20 . drwxrwxr-x 23 ruben rubo77 4096 Feb 6 21:48 .. ... But it will show the whole content of the ...
7
votes
2answers
695 views

Is there a correct way to list the subdirectories of the current directory?

I can find the subdirectories of a directory by ls -d -- */ or ls -l | grep "^d" but both of these seem indirect, and I would imagine that there would be a standard way to find just the ...
4
votes
1answer
59 views

Getting new files to inherit group permissions on Linux

I am having a problem with permissions on a Linux server. I am used to BSD. When a directory is owned by a group the user who owns it isn't in such as www-data, files created in it will be owned by ...
1
vote
3answers
164 views

What makes the files in my home directory appear, when I log in through SSH then run ecryptfs-mount-private?

I'm a bit of a newbie when it comes to using Linux. I've recently installed Ubuntu 12.04 LTS (minimal virtual machine) on a VPS host. I've encrypted the virtual disk and encrypted the home directory ...
3
votes
1answer
56 views

Tab completion of “../” in zsh

One noob question from a new zsh user: In bash, I can use tab-completion to move one directory up and descend down again another path. For example, suppose I'm in $HOME/folder1, and I want to cd to ...
2
votes
2answers
24 views

Specialized access control for directories in RedHat

I have a requirement where I want to change permissions for a directory so that the directory owner (user/group) would be able to create files inside the directory and modify them, but won't be able ...
0
votes
2answers
67 views

How can I concatenate all files in a directory together in one command line operation? [duplicate]

I have 1000 csv files in a directory. I would like to concatenate them all together in order. They are named img_size_1.csv to approx img_size_1000.csv This answer is close but assumes a list file. ...
1
vote
1answer
36 views

Using SUDO to execute a general command inside a non-accessible directory

I want to grep something inside a directory. But the user dont have permissions in the direcotry. Because of some reasons, i am not allowed to change permissions, group or owner. Just want to know i ...
2
votes
4answers
76 views

cd two levels down from root

I'm a web developer (Drupal mainly). When I develop websites I do so within a /workspace folder. So I have folders like this. /workspace/project/ /workspace/project/sites/default/files/ ...
19
votes
5answers
12k 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. ...
4
votes
1answer
40 views

ls -l --group-directories-first (act on symlinks as well)

ls option --group-directories-first causes directories to be listed on the top, which makes the output of ls nice and clean: ls -l --group-directories-first However, it does not act on symlinks, ...
3
votes
2answers
59 views

set umask (permissions) similarly as setgid on a directory

I know how to use setgid on directories, to enforce that whole directory structure has uniform user:group ownership. Is there a similar way to set the umask for a directory, so that the whole ...
7
votes
4answers
2k views

pv for directory copy

I need to copy a very large directory (talking in terabytes here) and want to monitor the progress. I found that pv is a nice utility, but how can I use it for copying directories recursively? (pv ...
1
vote
1answer
33 views

How to open a directory and save code in it Gerris in Linux?

I am new to this Unix and Gerris (software) world. I have to simulate. but I cannot open and type these codes below in vortivcity directory.I am using remote connection from mac to university machine. ...
50
votes
3answers
13k views

Why hard links not allowed to directories in UNIX/Linux

I read in text books that UNIX/Linux doesn't allows hard links to directories but soft links do. Is it because, when we have cycles and if we create hardlinks, and after some time we delete the ...