Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 4 years ago.
Improve this question
I'm trying to make symbolic links in my Dropbox so that I don't have duplicate files all over my computer (file space is limited). I've come across some confusing behavior in ln -s vs. cp -s. Basically, ln -s seems to make a link to the original folder, but then copies all the files within the folder to a new location. cp -sr recursively makes links to all files within the folder (which is the desired behavior).
For example:
nate#auerilas ~ $ mkdir ~/Desktop/test_ln
nate#auerilas ~ $ mkdir ~/Desktop/test_cp
nate#auerilas ~ $ cp -sr ~/Documents/GIS_Files/WorldClim2/Monthly/Prec/ ~/Desktop/test_cp
nate#auerilas ~ $ ln -s ~/Documents/GIS_Files/WorldClim2/Monthly/Prec/ ~/Desktop/test_ln
nate#auerilas ~ $ cd ~/Desktop/test_cp/Prec
nate#auerilas ~/Desktop/test_cp/Prec $ ls -ls
total 52
4 lrwxrwxrwx 1 nate nate 65 Apr 27 11:40 readme.txt -> /home/nate/Documents/GIS_Files/WorldClim2/Monthly/Prec/readme.txt
4 lrwxrwxrwx 1 nate nate 76 Apr 27 11:40 wc2.0_30s_prec_01.tif -> /home/nate/Documents/GIS_Files/WorldClim2/Monthly/Prec/wc2.0_30s_prec_01.tif
4 lrwxrwxrwx 1 nate nate 76 Apr 27 11:40 wc2.0_30s_prec_02.tif -> /home/nate/Documents/GIS_Files/WorldClim2/Monthly/Prec/wc2.0_30s_prec_02.tif
4 lrwxrwxrwx 1 nate nate 76 Apr 27 11:40 wc2.0_30s_prec_03.tif -> /home/nate/Documents/GIS_Files/WorldClim2/Monthly/Prec/wc2.0_30s_prec_03.tif
4 lrwxrwxrwx 1 nate nate 76 Apr 27 11:40 wc2.0_30s_prec_04.tif -> /home/nate/Documents/GIS_Files/WorldClim2/Monthly/Prec/wc2.0_30s_prec_04.tif
4 lrwxrwxrwx 1 nate nate 76 Apr 27 11:40 wc2.0_30s_prec_05.tif -> /home/nate/Documents/GIS_Files/WorldClim2/Monthly/Prec/wc2.0_30s_prec_05.tif
4 lrwxrwxrwx 1 nate nate 76 Apr 27 11:40 wc2.0_30s_prec_06.tif -> /home/nate/Documents/GIS_Files/WorldClim2/Monthly/Prec/wc2.0_30s_prec_06.tif
4 lrwxrwxrwx 1 nate nate 76 Apr 27 11:40 wc2.0_30s_prec_07.tif -> /home/nate/Documents/GIS_Files/WorldClim2/Monthly/Prec/wc2.0_30s_prec_07.tif
4 lrwxrwxrwx 1 nate nate 76 Apr 27 11:40 wc2.0_30s_prec_08.tif -> /home/nate/Documents/GIS_Files/WorldClim2/Monthly/Prec/wc2.0_30s_prec_08.tif
4 lrwxrwxrwx 1 nate nate 76 Apr 27 11:40 wc2.0_30s_prec_09.tif -> /home/nate/Documents/GIS_Files/WorldClim2/Monthly/Prec/wc2.0_30s_prec_09.tif
4 lrwxrwxrwx 1 nate nate 76 Apr 27 11:40 wc2.0_30s_prec_10.tif -> /home/nate/Documents/GIS_Files/WorldClim2/Monthly/Prec/wc2.0_30s_prec_10.tif
4 lrwxrwxrwx 1 nate nate 76 Apr 27 11:40 wc2.0_30s_prec_11.tif -> /home/nate/Documents/GIS_Files/WorldClim2/Monthly/Prec/wc2.0_30s_prec_11.tif
4 lrwxrwxrwx 1 nate nate 76 Apr 27 11:40 wc2.0_30s_prec_12.tif -> /home/nate/Documents/GIS_Files/WorldClim2/Monthly/Prec/wc2.0_30s_prec_12.tif
nate#auerilas ~ $ cd ~/Desktop/test_ln/Prec
nate#auerilas ~/Desktop/test_ln/Prec $ ls -ls
total 1030608
8 -rw-rw-r-- 1 nate nate 256 Jul 4 2016 readme.txt
74828 -rw-rw-r-- 1 nate nate 76618603 Jun 30 2016 wc2.0_30s_prec_01.tif
76620 -rw-rw-r-- 1 nate nate 78453928 Jun 30 2016 wc2.0_30s_prec_02.tif
86664 -rw-rw-r-- 1 nate nate 88738160 Jun 30 2016 wc2.0_30s_prec_03.tif
89424 -rw-rw-r-- 1 nate nate 91564709 Jun 30 2016 wc2.0_30s_prec_04.tif
88272 -rw-rw-r-- 1 nate nate 90386408 Jun 30 2016 wc2.0_30s_prec_05.tif
90364 -rw-rw-r-- 1 nate nate 92524861 Jun 30 2016 wc2.0_30s_prec_06.tif
92252 -rw-rw-r-- 1 nate nate 94459125 Jun 30 2016 wc2.0_30s_prec_07.tif
94700 -rw-rw-r-- 1 nate nate 96964870 Jun 30 2016 wc2.0_30s_prec_08.tif
88708 -rw-rw-r-- 1 nate nate 90829431 Jun 30 2016 wc2.0_30s_prec_09.tif
92756 -rw-rw-r-- 1 nate nate 94977702 Jun 30 2016 wc2.0_30s_prec_10.tif
79808 -rw-rw-r-- 1 nate nate 81716504 Jun 30 2016 wc2.0_30s_prec_11.tif
76204 -rw-rw-r-- 1 nate nate 78025342 Jun 30 2016 wc2.0_30s_prec_12.tif
Note the difference in file sizes between the two methods, and the lack of a link for the files made by ln -s. If I go into my file browser and right click to look at the properties, I also see something different.
ln -s
Type Image
Size 76.6 MB
Location /home/nate/Desktop/test_ln/Prec
cp -sr
Type Link to Image
Link target /home/nate/Documents/GIS_File..nthly/Prec/wc2.0...
Size 76.6 MB
Location /home/nate/Desktop/test_cp/Prec
So cp -sr seems to be actually linking each file in a directory, whereas ln -s seems to link the top folder only and copying the files within the folder, thus duplicating files.
Is that correct?
The problem is that if I use cp -sr, only the files themselves are linked, not the top folder. So if I add or delete a file on my harddrive, the change isn't then copied to Dropbox
Running Linux Mint 18.3
You're correct. Here's info cp explicitly saying that it only links non-directories:
‘-s’
‘--symbolic-link’
Make symbolic links instead of copies of non-directories.
Related
I'm trying to use mpicxx with cygwin. I've installed all openmpi packages available but when typing mpicxx still get a "command not found". I looked into the /usr/bin folder and mpicxx is missing, while C and fortran versions are there. Any possible explanation or solution?
StackOverflow is for programming question not for support.
Cygwin support requests should be sent to the Cygwin mailing list
https://cygwin.com/cygwin/lists.html
This particular question was already asked and the answer is at
https://cygwin.com/ml/cygwin/2018-09/msg00180.html
mpic++ and mpicxx are just links to opal_wrapper.exe you can reinstate
by yourself
It is the same for all the other compilers
$ cd /bin
$ ls -l mpi*
lrwxrwxrwx 1 Marco Kein 16 Sep 13 12:17 mpic++ -> opal_wrapper.exe
-rwxr-xr-x 1 Marco Kein 18K Mar 19 2018 mpicalc.exe
lrwxrwxrwx 1 Marco Kein 16 Sep 5 16:46 mpicc -> opal_wrapper.exe
lrwxrwxrwx 1 Marco Kein 11 Sep 5 16:46 mpiexec -> orterun.exe
lrwxrwxrwx 1 Marco Kein 16 Sep 5 16:46 mpif77 -> opal_wrapper.exe
lrwxrwxrwx 1 Marco Kein 16 Sep 5 16:46 mpif90 -> opal_wrapper.exe
lrwxrwxrwx 1 Marco Kein 16 Sep 5 16:46 mpifort -> opal_wrapper.exe
lrwxrwxrwx 1 Marco Kein 11 Sep 5 16:46 mpirun -> orterun.exe
I am running Visual Studio Code Version 1.19.3 on Linux Mint 18.3. When I try to execute binaries that I can clearly see and run in my external terminal, they cannot be found. When I 'ls' /usr/bin from the integrated terminal, many files are missing and others are different versions.
External bash /usr/bin ls snippet:
-rwxr-xr-x 1 root root 10392 Jan 30 2016 pgmtolispm
-rwxr-xr-x 1 root root 17048 Jan 30 2016 pgmtopbm
-rwxr-xr-x 1 root root 10392 Jan 30 2016 pgmtoppm
-rwxr-xr-x 1 root root 27280 Nov 21 2016 pgrep
lrwxrwxrwx 1 root root 22 Jan 15 21:29 phar -> /etc/alternatives/phar
lrwxrwxrwx 1 root root 12 Aug 9 10:43 phar7.0 -> phar.phar7.0
lrwxrwxrwx 1 root root 27 Jan 15 21:29 phar.phar -> /etc/alternatives/phar.phar
-rwxr-xr-x 1 root root 14826 Aug 9 10:42 phar.phar7.0
lrwxrwxrwx 1 root root 21 Jan 15 21:29 php -> /etc/alternatives/php
-rwxr-xr-x 1 root root 4430896 Aug 9 10:43 php7.0
-rwxr-xr-x 1 root root 6264 Jan 30 2016 pi1toppm
-rwxr-xr-x 1 root root 10384 Jan 30 2016 pi3topbm
-rwxr-xr-x 1 root root 200736 Jan 29 2016 pic
Integrated terminal /usr/bin ls snippet:
-rwxr-xr-x 3 nfsnobody nfsnobody 45393 Dec 31 1969 perlthanks
-rwxr-xr-x 2 nfsnobody nfsnobody 14408 Dec 31 1969 pfbtops
-rwxr-xr-x 2 nfsnobody nfsnobody 38896 Dec 31 1969 pg
-rwxr-xr-x 3 nfsnobody nfsnobody 26680 Dec 31 1969 pgrep
-rwxr-xr-x 2 nfsnobody nfsnobody 200696 Dec 31 1969 pic
Is VSC creating some kind of virtual filesystem for the terminal that has its own /usr/bin, but still attaches my working folder in the right path? I am lost and it is preventing me from being able to use the Google debugger and PHP Intellisense, just to name a couple of things.
I've tried to use vim-gitgutter but it doesn't work and I even don't know where to find a root of error.
$ git --version
git version 1.9.3 (Apple Git-50)
$ vim --version | head -1
VIM - Vi IMproved 7.3 (2010 Aug 15, compiled Sep 12 2013 14:04:26)
$ ll ~/.vim/autoload/pathogen.vim
-rw-r--r-- 1 coder staff 12K 8 Dec 23:32 /Users/coder/.vim/autoload/pathogen.vim
$ ll ~/.vim/bundle/vim-gitgutter
total 56
-rw-r--r-- 1 coder staff 12K 8 Dec 23:17 README.mkd
drwxr-xr-x 4 coder staff 136B 8 Dec 23:17 autoload
drwxr-xr-x 3 coder staff 102B 8 Dec 23:17 doc
drwxr-xr-x 3 coder staff 102B 8 Dec 23:17 plugin
-rw-r--r-- 1 coder staff 16K 8 Dec 23:17 screenshot.png
drwxr-xr-x 39 coder staff 1,3K 8 Dec 23:17 test
:echo has('signs') returns 1 as it should and I can see the differences by git diff
It turned out that pathogen wasn't activated and it didn't load gitgutter. I fixed it by adding the following line to ~/.vimrc
execute pathogen#infect()
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 9 years ago.
Improve this question
When I need to create a autostartup task in Ubuntu. I always create a new file and write a bunch of commands into it. Next, I place this file in the /etc/init.d/ directory. Then, I set chmod 755 for this file. Finally, I execute the command line "update-rc.d file_name defaults" to activate it. And it works like a charm.
Recently, I found that there was another way to make it work the same to this above example. That is appending a new command line into /etc/rc.local (place it above the "exit 0" line).
So could you tell the difference between them ? Thank you very much !
To understand this problem, the first thing you should know is run level in *nix. There are total 6 run level in *nix. I won't show details of each run level, you can read more about it here.
Each run level have separate locations under /etc/:
% cuonglm at ~
% ls -l /etc/rc* -d
drwxr-xr-x 2 root root 4096 Feb 20 10:44 /etc/rc0.d
drwxr-xr-x 2 root root 4096 Feb 20 10:44 /etc/rc1.d
drwxr-xr-x 2 root root 4096 Feb 20 10:44 /etc/rc2.d
drwxr-xr-x 2 root root 4096 Feb 20 10:44 /etc/rc3.d
drwxr-xr-x 2 root root 4096 Feb 20 10:44 /etc/rc4.d
drwxr-xr-x 2 root root 4096 Feb 20 10:44 /etc/rc5.d
drwxr-xr-x 2 root root 4096 Feb 20 10:44 /etc/rc6.d
-rwxr-xr-x 1 root root 306 Feb 4 18:58 /etc/rc.local
drwxr-xr-x 2 root root 4096 Feb 4 19:01 /etc/rcS.d
Everytime your system boots, some scripts (which start with S) under the coressponding run level folder is executed. I.E if you boot in to run level 2, some scripts under /etc/rc2.d/ will executed. If you show content of these folder, you'll see that scripts is a symlink of scripts under /etc/init.d/.
% ls -l /etc/rc2.d/
total 4
-rw-r--r-- 1 root root 677 Jul 27 2012 README
lrwxrwxrwx 1 root root 20 Feb 19 11:26 S20kerneloops -> ../init.d/kerneloops
lrwxrwxrwx 1 root root 27 Feb 19 11:26 S20speech-dispatcher -> ../init.d/speech-dispatcher
lrwxrwxrwx 1 root root 20 Feb 19 11:26 S50pulseaudio -> ../init.d/pulseaudio
lrwxrwxrwx 1 root root 15 Feb 19 11:26 S50rsync -> ../init.d/rsync
lrwxrwxrwx 1 root root 15 Feb 19 11:26 S50saned -> ../init.d/saned
lrwxrwxrwx 1 root root 19 Feb 19 11:26 S70dns-clean -> ../init.d/dns-clean
lrwxrwxrwx 1 root root 18 Feb 19 11:26 S70pppd-dns -> ../init.d/pppd-dns
lrwxrwxrwx 1 root root 14 Feb 19 11:26 S75sudo -> ../init.d/sudo
lrwxrwxrwx 1 root root 17 Feb 20 10:44 S91apache2 -> ../init.d/apache2
lrwxrwxrwx 1 root root 22 Feb 19 11:26 S99acpi-support -> ../init.d/acpi-support
lrwxrwxrwx 1 root root 21 Feb 19 11:26 S99grub-common -> ../init.d/grub-common
lrwxrwxrwx 1 root root 18 Feb 19 11:26 S99ondemand -> ../init.d/ondemand
lrwxrwxrwx 1 root root 18 Feb 19 11:26 S99rc.local -> ../init.d/rc.local
This give you an ability to control your service to run under which runlevel. You can make your service run in only run level 2 and stop in others run level. But remember, Only one "runlevel" is executed on bootup, i.e. either runlevel 2 OR 3 OR 4 is executed, not 2 then 3 then 4.
So it leads you to the difference here. In each run level you boot in, after scripts of this run level is executed, the script /etc/rc.local is executed. It means that /etc/rc.local will run at the end of boot process, regardless of run level you boot in.
I'm having a problem where when I edit a file, it's modified timestamp is set to a time in the future
Illustration of the problem:
$ make
make: Nothing to be done for `all'.
$ touch makefile
$ make
make: Warning: File `makefile' has modification time 19 s in the future
make: Nothing to be done for `all'.
make: warning: Clock skew detected. Your build may be incomplete.
If I edit the file that same thing happens (ie: this is not a problem unique to touch)
More details:
$ date
Thu Jan 24 20:18:19 EST 2013
$ ls -l
total 24
-rw-rw-r--. 1 steve steve 13907 Jan 24 20:18 makefile
-rw-rw-r--. 1 steve steve 23 Jan 24 19:54 modules.mk
drwxrwxr-x. 3 steve steve 4096 Jan 24 19:54 test
$ touch makefile
$ ls -l
total 24
-rw-rw-r--. 1 steve steve 13907 Jan 24 2013 makefile <-- in the future!
-rw-rw-r--. 1 steve steve 23 Jan 24 19:54 modules.mk
drwxrwxr-x. 3 steve steve 4096 Jan 24 19:54 test
$ ls -l
total 24
-rw-rw-r--. 1 steve steve 13907 Jan 24 20:18 makefile
-rw-rw-r--. 1 steve steve 23 Jan 24 19:54 modules.mk
drwxrwxr-x. 3 steve steve 4096 Jan 24 19:54 test
$ date
Thu Jan 24 20:18:48 EST 2013
How can I edit the file and have it's modified time set to now?
I had the same problem a long time ago using NFS. It drove me crazy! The host where the files were stored and my own computer where not syncronized in time. I had to request the system managers to install NTP.