A file system structure in which to store computer files.

learn more… | top users | synonyms

68
votes
6answers
18k 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 ...
1
vote
0answers
61 views

xdg user dirs: not relocating although set?

I relocated my home directories using XDG user dirs as mentioned here: how to make gnome use my home folder as Desktop folder? However, this does not work for me so far. I have set the Downloads ...
3
votes
4answers
373 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 ...
10
votes
4answers
5k views

symbolic link to a directory and relative path

I've created symlink with absolute path to the directory (Blink) and have for example following tree: $ ls -l /tmp/A total 0 lrwxrwxrwx 1 root root 6 Apr 3 12:27 Blink -> /tmp/B -rw-r--r-- 1 root ...
1
vote
1answer
450 views

Trouble installing lxml with custom install location for libxml2/libxslt

I am attempting to install a python module called lxml to my account on a supercomputer running RHEL. I do NOT have root access or super user status. lxml requires the dev/devel versions of libxml2 ...
3
votes
1answer
81 views

The history of ../

I was wondering if there's a known reason behind the use of .. to represent the parent of the current directory in most operating systems. The reason I ask this question is because I think that the ...
1
vote
2answers
38 views

How to find number of Subdirectories under a given directory

In windows you get a count of the number of subdirectories within a directory.Is there any equivalent on Linux ? I'd like it to count recursively & Not stop at a single level.
5
votes
3answers
53 views

Is there an easy way to change directories from within one duplicate folder structure to another?

On our server, we have several duplicate-ish folder structures for testing, staging, and production. Other than minor changes, the folder structure between all three are generally the same. When I'm ...
0
votes
0answers
17 views

inotifywait to monitor shared directory on laravel homestead

I need to watch a directory that is shared on a network for new files. I used inotifywait from inotify-tools and it is great except when the file is added from the other place. For example: I am ...
3
votes
1answer
57 views

how to make gnome use my home folder as Desktop folder?

Environment: Debian 7, gnome-shell. I dislike having a Desktop folder and a Home folder. I like all the applications to use my home folder. Specifically I am concerned about nautilus and ...
2
votes
2answers
44 views

ls doesn't give me the same as cd + ls to the same folder

$> ls ../../../../.. Doesn't give me the same result as $> cd ../../../../.. $> ls Why? Something with links? What's going on? [ johanrj@jamin ] ...
0
votes
0answers
28 views

Failed to list directory contents: process waits infinitely

I use Linux Mint 13, and sometimes (rarely) I find myself not being able to list my home directory contents. When I try to do so: $ cd $ ls then, ls just waits indefinitely. The same with any other ...
0
votes
2answers
26 views

Tool for visual directory comparison

This question is not about visual diff -- i.e. file comparison. Is there a tool which let me compare directory A and B (recursively), and as the output I would get two panes, with lists -- files in A ...
0
votes
4answers
38 views

number of folders in a directory (recursive)

I would like to find the number of folders (recursive, excluding hidden folders) in a given root directory. What command, or series of commands can I use to ascertain this information?
3
votes
1answer
42 views

How to update directory size after file removal?

This is mostly theorethical question without real practical usage. As you may know, filenames are stored in directory inode. That means the more files we have and the longer filenames are the more ...
1
vote
1answer
22 views

du -sh on a new directory gives different results in different locations

Here's what happened when I created a new directory and immediately ran du on it. There are no contents in this directory. me@mybox[~]$ mkdir /scratch/test2 me@mybox[~]$ du -sh /scratch/test2 4.0K ...
9
votes
1answer
601 views

What is the difference between 'ls' and 'ls -l' when I don't have execute permission on that directory?

I created a directory called folder and took away execute permission. $ mkdir folder $ touch folder/innerFile $ mkdir folder/innerFolder $ chmod -x folder Now if I do $ ls folder it outputs a ...
2
votes
1answer
27 views

Problem with install command to copy a whole directory

So I have a repo with some of my config files and I'm trying to create a makefile to install them in the homedir. The problem I have is that when I run the following command straight in bash install ...
0
votes
1answer
39 views

Extracting tar.gz from distance

I would like to extract a single file from a tar.gz file, but its in another folder than I am currently in. Is it possible to extract from "distance"?
1
vote
1answer
29 views

Adding files to .tar from directory

Is there a way to add files to .tar file in one directory from an another directory? And at the same time list the content of the tar to see if its added. I only found ways to add files if its in the ...
2
votes
2answers
75 views

What filesystem mount point am I currently working on?

I would like to know in what filesystem mount point I am currently on, similarly to using pwd to know what directory I am in. I know you can use df . (or df $(pwd) or many variants), but I find it ...
0
votes
1answer
62 views

Why the size of an empty directory in Linux is 4KB? [duplicate]

I'm using Ubuntu 14.04 and I made an empty directory on /tmp with the mkdir command: cd /tmp mkdir foo and then I checked it's size using ls: ls -ldh foo and the result shows that the size of ...
1
vote
1answer
32 views

Help understanding and using Symlinks

I have a bit of a situation with a virtual server running some RHEL distro. The server is hosted on a Win2008 server via VMPlayer ( I'm going to smack the guy who set this up.) When it was created ...
1
vote
1answer
80 views

How to output the directory structure to Json format [duplicate]

I have been using 'find' to output the directory structure from the root down and I don’t mind that it takes a while. My problem is that I want to cut down on the redundant info of repeating every ...
5
votes
1answer
62 views

How do folder name localizations work?

In Mac OS X, there are directories like Desktop, Users and Library. On localized systems, these would be named Skrivbord, Användare and Bibliotek (Swedish) But when I am in the terminal I can't ...
10
votes
6answers
38k 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 ...
73
votes
1answer
84k 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 ...
0
votes
1answer
7k 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 ...
6
votes
2answers
122 views

Folder with ONLY write permission is useless… right?

Having worked with Linux for years, and finding myself with some free time, I decided to revisit some basics. So I re-read the stuff about permissions (without checking source code), and its special ...
0
votes
1answer
45 views

Linux: Recovering a deleted dir that another terminal is still cd'ed into

I accidentally deleted the dir, /path/to/dir, and all its contents from an application. However, I still have a terminal window open, still cd-ed in /path/to/dir! Q: Is there any way to recursively ...
0
votes
1answer
38 views

Executable directory? And chmod o+w changing the terminal directory color?

What does an executable directory mean? If o+w is set the directory changes colors to a background green, what does this mean? Why doesn't it do it for ug+w, but only for o+w? Additional question ...
16
votes
4answers
11k views

Converting relative path to absolute path

Is there a *nix command to get absolute(and canonicalized) path from relative path(with current path) or symbolic link?
2
votes
2answers
98 views

Folder alias / Symbolic link to return to back folder

I need to create a folder "2015" which re-routes to ./ but I don't know what the command is. Not sure if the term is called in this case an alias (or symbolic link). So I need to make the same ...
9
votes
2answers
2k views

Stay at same working directory when changing to sudo

When working on the command line, I often change to sudo using sudo -i. However, my working directory changes automatically to /root. I never want to go there; I want to stay where I was! How can I ...
-4
votes
1answer
26 views

Arrange for files created in a directory to belong to the directory's group

How do I set permissions so that whoever creates any files or directories in /directory, the group owner should automatically be the same group owner of /directory? This is on RHEL.
2
votes
1answer
44 views

When is a symlink treated as the thing it links to, and as a symlink?

When is a symlink treated as the thing it links to, and as a symlink? A symlink can links to a file of different types. For example, let mylk be a symlink which links to a dir. The following two ...
3
votes
1answer
27 views

Check for missing files in two directories and their respective subdirectories

Folder alpha has one subfolder, and files in both root and in subfolder. Folder beta has 25 subfolders with files in them. How would I compare the file contents of alpha and beta, checking for ...
1
vote
0answers
19 views

What means a number of links > 1 for directories? [duplicate]

Both programs stat and ls -l tell about the number of (hard) links to file(s). Going under the assumption that one usually cannot create hardlinks for directories in Linux it confuses me to see ...
0
votes
0answers
38 views

How to create a hardlink to a directory in Solaris?

I started to study the Solaris in my university. Teacher told me to do a hardlink to a directory. And he said that I can not to use mount command. For example: # mount -F lofs /dir1/dir2 ...
14
votes
3answers
57k 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
43 views

Unzip into directory, independent if directory is contained in ZIP

Let's assume I've a ZIP file whichs content may look like # file: with_out_dir.zip file1.txt file2.cpp file3.js some_sub_dir/ - file_in_subdir.txt file4.xml but it may also look like this # file: ...
1
vote
1answer
42 views

How do I execute a command in each subdirectory? [duplicate]

I'm using Puppet and I need to create symlinks between two folders. I have around 10 folders with the same structure and I always want to execute my link command in xx/yy/zz. Something like this: ln ...
3
votes
1answer
269 views

mv and cp directory hierarchy? [duplicate]

Can I also move or copy directory hierarchy of a file when I mv or cp the file? For example, if I mv or cp dir1/dir2/file elsewhere, it will only mv or cp file. What if I want to also mv or cp ...
51
votes
3answers
2k views

Why does '/' have an '..' entry?

This just baffles me. Why does the root directory contain a reference to a parent directory? bob@bob:/$ ls -a . build home lib32 mnt .rpmdb sys vmlinuz .. cdrom ...
0
votes
0answers
29 views

Why are my directories and files created with bashscripts ending with \r? (Script Example) [duplicate]

Okay so I'm really confused but that is cause I know next to nothing about bash scripting. My problem is when I get the script to work it creates directories and files with the \r ending and that ...
0
votes
1answer
60 views

Is possible to change the value of '.' without actually change the current directory? [closed]

Can I make the value of . to be a different directory from the current directory? Background I'm learning Java. In the directory of my program, I have two sub-directories, src and bin. Every time I ...
2
votes
1answer
71 views

How to let a user create a directory although not create a sub directory

I'm trying to create a Bash shell script that allows for the transfer of files from a flash device to a archive in which the user will specify. Although I'd like to restrict this user from not being ...
0
votes
2answers
54 views

ls hard link question

I run ls -la on the Volumes directory. It shows the MM dir to have 9 hard links and the Media dir to have 12. If I then cd to the MM directory and run ls -la, it shows only 7 items whereas if I cd to ...
2
votes
4answers
318 views

“mv: cannot move `.' to `../general/.': Device or resource busy”

$ mv . ../general/ mv: cannot move `.' to `../general/.': Device or resource busy Does it mean that the current directory is a busy device or resource, and can't be moved away? Why is it?
0
votes
4answers
92 views

Is /home a subdirectory of /?

In my Ubuntu 12.04, /home and / are different partitions. But why does /home look like a subdirectory of /? Is it because it is a hard link: Are there five hard links which link to the same dir as ...