Tag Info

Hot answers tagged

35

The switch you need is --parents, e.g.: jim@prometheus:~$ cp --parents test/1/.moo test2/ jim@prometheus:~$ ls -la test2/ total 42 drwxr-xr-x 3 jim jim 72 2010-09-14 09:32 . drwxr-xr-x 356 jim jim 43136 2010-09-14 09:32 .. drwxr-xr-x 3 jim jim 72 2010-09-14 09:32 test jim@prometheus:~$ ls -la test2/test/1/.moo -rw-r--r-- 1 jim jim 0 2010-09-14 ...


31

You don't. At least not just like that. The preceding line in the quoted document is of importance: Set up your prompt to do a pwd everytime you cd. Always do a cd . before doing anything. This way, you as the operator verify your current working dir before doing anything of importance, as it's printed out with each change. cd . doesn't make ...


30

According to the FHS, /usr is for shareable, read-only data - not where you want to put the website. This is where you should put your code (for example Fedora does this for Wordpress). See also the web assets packaging guide for Fedora. /var is "variable data files. This includes spool directories and files, administrative and logging data, and transient ...


28

Strangely enough /usr actually means Unix System Resources. "The "etc" in "/etc/bin" really does stand for "etcetera." In early Unix systems, the most important directory was the "bin" directory (short for "binaries" -- compiled programs), and "etc" was for trivial stuff like startup, shutdown and admin. The list of things you need for running Linux is: a ...


27

Use the -R or --relative option to preserve the full path.


27

So sorry, I should've RTFM ... http://svnbook.red-bean.com/en/1.5/svn.ref.svn.c.add.html You can add a directory without adding its contents: $ svn add --depth=empty otherdir A otherdir Edit: This doesn't work recursively though, is there any way to do that too?


24

Would it be possible to backup all of the other files from this file system to a temporary storage location, reformat the partition, and then restore the files?


23

Whilst a major cause of this problem is ext3 performance with millions of files, the actual root cause of this problem is different. When a directory needs to be listed readdir() is called on the directory which yields a list of files. readdir is a posix call, but the real linux system call being used here is called 'getdents'. Getdents list directory ...


22

(Note: ~ translates as /home/user in this post) Personally, I put all of my custom-made system scripts in /usr/local/bin and all of my personal bash scripts in ~/bin. Very few programs I install place themselves in /usr/local/bin directory so it's not very cluttered and it was already in the $PATH variable on most of my machines. To add /usr/local/bin to ...


21


20

For more data on the layout of Linux file-systems, look at the Filesystem Hierarchy Standard (now at version 2.3, with the beta 3.0 version deployed on most recent distros). It does explain some of where the names came from: /bin - Binaries. /boot - Files required for booting. /dev - Device files. /etc - Etcctera. The name is inherited from the earliest ...


18

The data=writeback mount option deserves to be tried, in order to prevent journaling of the file system. This should be done only during the deletion time, there is a risk however if the server is being shutdown or rebooted during the delete operation. According to this page, Some applications show very significant speed improvement when it is used. For ...


17

Historically, /etc stands for "etcetera" and /var is short for "variable." I suppose the former is because a large collection of unrelated system configuration files go into /etc. The latter is because the files in /var are expected to change. You can often mount /usr and / as read-only (except when performing updates), but you can never mount /var ...


17

Take a look at the Filesystem Hierarchy Standard (Wikipedia). I myself use /srv/www/$domain/{htdocs,logs,cgi-bin,...}.


17

If the current working directory of your shell is removed, it is possible to lose data. For example, $ pwd /home/user/test $ rmdir /home/user/test $ pwd /home/user/test $ some_command | tee command.log tee: command.log: No such file or directory <long output> The output of some_command was not written to the disk. Typing cd . before running a ...


16

You're looking for diff -rq (dir1) (dir2) Proof of concept: #!/bin/sh #create our test mkdir -p /tmp/a/b echo "test" >> /tmp/a/c mkdir -p /tmp/a/d/e echo "blah" >> /tmp/a/d/e/f #only exists here mkdir -p /tmp/q/b echo "testing" >> /tmp/q/c #/tmp/a/c shouldnt match mkdir -p /tmp/q/d/e echo "blah" >> /tmp/q/d/e/g #only exists here ...


16

You might find the output from "man hier" fascinating


15

If you're considering scripting it, it's always helpful to learn about the pushd and popd commands. Sometimes you can't be sure what drives letters are already used on the machine that the script will run on and you simply need to take the next available drive letter. Since net use will require you to specify the drive, you can simply use pushd ...


14

One option is to use unionfs Unionfs: A Stackable Unification File System This project builds a stackable unification file system, which can appear to merge the contents of several directories (branches), while keeping their physical content separate. Unionfs is useful for unified source tree management, merged contents of split ...


14

That limit is per-directory, not for the whole filesystem, so you could work around it by further sub-dividing things. For instance instead of having all the user subdirectories in the same directory split them per the first two characters of the name so you have something like: top_level_dir |---aa | |---aardvark1 | |---aardvark2 |---da | |---dan | ...


14

This really depends on how you are going to restore your system. If you will rebuild then you only need the configuration/data files for your services (eg: /etc, /opt, /var, /home) If you are after a full system restore, then it you could omit /proc, /boot & /dev. Then you can install the minimum OS from your boot media and then restore your system via ...


13

There's only one kind of symbolic link. The issue you're seeing with FTP is probably that the FTP server is restricted to a subtree of the filesystem (this is called a chroot jail), and a symbolic link pointing outside that subtree won't work. That's by design: the chroot jail is for security, and you mustn't be able to escape the jail by following a ...


13

I know it's not the answer you're looking for, but I believe the correct solution is to avoid depending on the ordering of files in a directory. Maybe it's always consistent across all HFS+ filesystems, and maybe you could find a way to make it consistent in ext4 or some other filesystem as well, but it will cost you more trouble in the long run than it will ...


13

I think it's more important to show your current directory. On every linux server, I modify the prompt in /etc/bashrc by changing "W" to "w". [ "$PS1" = "\\s-\\v\\\$ " ] && PS1="[\u@\h \W]\\$ " to [ "$PS1" = "\\s-\\v\\\$ " ] && PS1="[\u@\h \w]\\$ " The effect of this is: [root@xt include]# versus [root@xt ...


12

If you type "!$" it will print the last argument of the previous line. Which will be the directory you moved the file into.


12

It requires a different virtual host. Just set up two virtual hosts that listen on different ports, let the second have a different document root and forbid access to 'something' within the first.


11

To strip down the parent directory: tar zxvf latest.tar.gz --strip 1 If you want to be sure that nothing from the parent directory is extracted: tar zxvf latest.tar.gz --strip 1 wordpress/directories Edit: --strip (--strip-path or --strip-components) was introduced in tar 1.14.


11

Sorry to resurrect an old thread, but I feel this detail is an important clarification for all future seekers of this info: /opt stands for optional (as in optional add-on packages). /bin stands for binary (contains executables used by the OS). /lib stands for library (contains shared libraries used by filesystem and for booting, probably used by the ...


11

Ask and ye shall receive: http://technet.microsoft.com/en-us/library/ee692796.aspx Counting the Number of Items in a Folder Well, what do you know: it looks like the sun is finally coming out, which means it’s almost time for us to go. Before we do, however, let’s show you one last little trick with the Get-ChildItem cmdlet. Sometimes ...



Only top voted, non community-wiki answers of a minimum length are eligible