A file system structure in which to store computer files.

learn more… | top users | synonyms

3
votes
4answers
440 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
525 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
2answers
100 views

List the 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 ...
6
votes
2answers
6k 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
719 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 ...
4
votes
1answer
288 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
39 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 ...
1
vote
2answers
1k 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
66 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
136 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/ ...
3
votes
1answer
401 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, ...
2
votes
2answers
131 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 ...
1
vote
1answer
77 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. ...
2
votes
1answer
42 views

Confusion on the cp command when creating a new directory

Let me explain my problem with a simpler scenario. We have these two directories: ~/Foo and ~/Bar. Foo contains the files test1.txt and test2.txt. If I run the command cp -R Foo Bar, the Bar directory ...
2
votes
3answers
124 views

Why can't I edit links and directories directly?

There are programs such as hexedit that allow one to edit each bit of a file, and as I keep hearing that in Unix "everything is a file", I tried to edit some directory, expecting bytes referring to ...
6
votes
3answers
1k views

find with execdir

I run a find with execdir both I don't get the results I was expecting. SSCCE below: mkdir -p a/b/c find . -type d -execdir touch foo \; $ tree a a ├── b │   ├── c │   └── foo └── foo Directory c ...
2
votes
0answers
70 views

How to restrict directory name creation to pattern?

I have FreeNas CIFS share. Mount command result: /dev/ufs/VSPHERE on /mnt/VSPHERE (ufs, NFS exported, local, soft-updates, nfsv4acls) I want to restrict users from creating directories that do not ...
2
votes
2answers
95 views

can I get the shell to decide ls or less depending on filetype?

Very often I find myself looking through directories using 'ls', then when I find the file I want, I use 'less' to look at the file. So for example to find a mysql log file I might type ls /var ...
2
votes
3answers
1k views

Can't cat a file or make a directory: contradictory output?

I am getting output from a terminal in Ubuntu 12 that I don't understand. $cat sublime no such file or directory $mkdir sublime cannot create directory 'sublime': File exists How can both of these ...
2
votes
2answers
536 views

Is a -rw-rw-rw- file really inaccessible inside a drwxrwx— directory?

Say I have a directory with these permissions: drwxrwx--- Inside this directory, a file with these permissions: -rw-rw-rw- Is the file readable/writable by everyone or not ? If not, how secure ...
2
votes
1answer
107 views

What is the tmp folder in /var?

I have a tmp folder in /var and it has the file channel.xml in it. I don't know what this is and if it should be there and what permissions it should have because at the moment it is wide open. Also ...
8
votes
1answer
1k views

Can rm recursively remove empty directories?

In an old version of Unix, the rm command would delete directories if they were empty. From the Research Unix Eighth Edition man page for rm: "If an entry is a directory it is removed only if empty." ...
3
votes
4answers
2k views

How to zip recursively all subdirectories that only contain text files

I have a backup from a disk that contains data files and analysis. The dir structure and names are not really consistent. To save space, I would like to zip all the subdirs that only contain data ...
3
votes
3answers
110 views

How do I search all subdirectories to find one with a certain name?

Let's say I have a top level directory called /dir and many sub directories. How do I search the subdirectories of /dir to find the one called x/x/dir/x/x/x/target? This question is similar to, but ...
51
votes
4answers
3k views

Pronunciation for /usr directory

How do you pronunce /usr? I found in the net that someone reads it "user"... but, for what I know, this directory is not related to the user. The meaning of the acronym is "Unix specific (or system) ...
1
vote
1answer
83 views

`ls` behavior on EACCES error for /root and /root/some-rubbish

I'm trying to code a clone of the ls command as part of a school exercise. I'm wondering why the following output is displayed by ls: $> ls -- -test_dir /root /root/some-rubbish ls: ...
5
votes
2answers
346 views

Show tail of files in a directory?

I have a directory that is too huge to browse by any means. Grepping returns argument lists too long, WINSCP crashes when trying to open the directory. Is there a way I can view just the last 200 ...
2
votes
1answer
111 views

Check for existence of files prior to acting on them

In one of my processes I check for existence of files older than 31 days, and then do stuff with them. find /my/directory/*txt -mtime +31 -exec ls -l {} \; All this is well and fine if files are ...
-1
votes
2answers
49 views

How can the number of files in a directory be determined by viewing “ls -ld” output? [duplicate]

The command has to be ls -ld Just from viewing the output of this, how can I determine how many files are in this directory?
4
votes
2answers
2k views

Why does a new directory have a hard link count of 2 before anything is added to it?

Say I just create directory newDirectory and then I do ls -ld command. I see that the number of hard links is 2. What exactly makes the hard link 2 from the start? Also is the number of subdirectories ...
0
votes
1answer
107 views

How can number of subdirectories and files be determined from ls -ld command? [closed]

How can number of subdirectories and files be determined from the output of using ls -ld command? I realize that this command only lists the directories.
0
votes
2answers
143 views

How can I for example list five largest files in /usr/lib -directory?

How can I for example list five largest files in /usr/lib directory? Please also add some minor explanation for each bit of code that you are using.
1
vote
1answer
41 views

for + array + args

I have problem with my for cycle, this is what I want: for arg do array[index]=(`find $arg -type l -maxdepth $depth -printf "%p\n" `) index++ done fi arg - positional arguments, only directories ...
1
vote
0answers
41 views

How can I specify an executable path that will work from any working directory? [closed]

I have a java process that runs in this directory: /home/zookeeper/zookeeper-3.4.5/org/zookeeper/Process.class That Java process will in turn launch another Java process that lives here ...
1
vote
2answers
173 views

Count entries for each directory in tree

Say I have the following tree: root: d foo d bar /foo: d A - tmp.txt /bar: d B - tmp2.txt /foo/A: - tmp3.txt /bar/B: d = directory and - = file I need to answer the following question: which ...
3
votes
1answer
175 views

How can there be a directory named `~`?

I was trying to test out this buggy/new tool to see how it works, and it prompted me to choose a directory to use for stuff I am doing. From the directory ~/Code/indep, I typed in ...
5
votes
1answer
2k views

quotas not linked to users but to directories

Usually, quotas are enforced per user, as related to the proprietary of the file. Is it possible to apply a quota on a folder basis, in such a way, that a folder contents are limited in disk space?
1
vote
1answer
195 views

Find a particular nesting of directory names, e.g. …/project/dir1/dir2

I'm having some issues dealing with the find command; I don't know the syntax for it very well and I need to use it in a script to find a specific directory structure that could be located anywhere. ...
3
votes
1answer
3k views

Extract single file from tar to other folder

I've searched for multiple forums for this questions and have seen different answers but so far, nothing have worked yet even from the ones I've seen here. I want to extract a single file from a tar ...
3
votes
1answer
111 views

Test for link with trailing slash?

I created in /tmp/test/ mkdir somedir ln -s somedir/ somelink I want to loop through only directories: for file in */ ; do if [[ -d "$file" && ! -L "$file" ]]; then echo "$file is a ...
0
votes
1answer
359 views

Extract a single file from a tar file and put it to another directory [duplicate]

I need to extract a single file from a tar file to another directory. So far I have this: This one extracts a single file to same directory: tar -xvf filename.tar ./file.txt I tried this but it's ...
-1
votes
1answer
170 views

Select a range of files from directory structure /year/month/date.db

I have databases stored in the directory structure year/month/date.db an example would be db/2013/10/15.db I need to be able to select a range of these with a script ("dbSelect ...
1
vote
2answers
149 views

Is there a problem if I add a non-existing path to `PATH` environment variable?

I have a following lines in my .bash_profile. if [ -d "$HOME/bin" ] ; then PATH="$HOME/bin:$PATH" fi I think I found it somewhere in the internet. Is it also ok, if I write only ...
1
vote
3answers
72 views

Can tree be used to list the number of files per level?

As title, I need to look into a particular directory and list the number of files per level. The directory is pretty large, about 10-15 levels deep. For instance, if I have the following: D1 | |-- ...
2
votes
3answers
3k views

cp --no-target-directory explained

Question: I need a simple example of how to use cp --no-target-directory. I do experience some difficulties in understanding cp --no-target-directory. I do understand the explanation for mv ...
2
votes
2answers
2k views

Resetting user directory permissions etc [closed]

My "Linux mint Debian edition" installation worked well until I used a live-CD to boot and then copied some files back and forth to and between the hard drive and a usb device. Now it says that it is ...
1
vote
2answers
1k views

How to find certain files and move them to a new directory in the same command?

So I was looking around and all I have found is how to do this only if the directory is already made, which is this: find source -name '*.z' -exec cp {} destination \; But how can I make a new ...
2
votes
2answers
62 views

Directory permissions vs file permssions

If I have two users called john and sally. Both are part of the users group. john creates a directory with permissions 775. sally then puts a file there with 644 permissions. Even though the file ...
5
votes
3answers
1k views

Recursively add a file to all sub-directories

How do I recursively add(or touch) a file into the current directory, as well as all sub-directories? For example, I would like to turn this directory tree: . ├── 1 │   ├── A │   └── B ├── 2 │   └── ...
4
votes
1answer
1k views

How search for a file beginning with either a or z and ending with a or z?

I attempted find -name 'a*' 'z*' '*a' '*z' but it gave me the error code find: paths must precede expression: z* I know how to find files starting with a though z, or ending with a-z, but not ...