Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I'm struggling to understand how Bash works (I'm using Mac OS X Lion).
I use the terminal for things like Git Version Control and SSH'ing onto our servers and doing basic interactions like that. But I don't really understand Bash scripts and the whole unix set-up past that.
So when I need to install software and it asks me to set environment variables (and PATH variables like $PATH e.g. export PATH=/usr/local/bin) or add paths to a file like /usr/local/bin/:usr/bin/:$PATH - I just have no idea of what I'm doing or more importantly "why" - it is just really confusing to me.
For example, why is there a /usr/local/bin/ and a /usr/bin/ (one local and one not?) and why does some software get installed in one and not the other?
And what about files like .bashrc, .profile and .bash_profile - I understand that .bashrc is executed when a shell starts up and it checks the paths inside that file for application settings and stuff like that, but why do I not have either .profile and .bash_profile on my work computer, but on my home laptop I have .bash_profile and in some places I've seen articles where people ask the user to set-up a .profile if it doesn't exist? Why not just one file for the shell to go to to look for stuff.
I've got NodeJs installed on my laptop at home and that has a path set-up under .bash_profile. I've recently tried installing rvm so I can try out some Ruby programming (I needed rvm so I could upgrade to the latest version of Ruby) but that has settings inside .bashrc such as PATH=$PATH:$HOME/.rvm/bin # Add RVM to PATH for scripting.
Sorry if I'm just repeating myself, but it seems like there just aren't any good articles about this sort of stuff. Articles are either non-existent OR they are over-kill so you never really understand the bits you're interested in (i.e. I don't want to know everything about UNIX just enough to understand these common items that seem to crop up a lot).
Again, this is a bit of a strange question because there isn't a specific thing I want to know, just the common stuff that crops us when you need to install software via the Terminal and you're asked to do things like setting paths and variables and choosing locations of where to install stuff (which bin folder to use) and stuff like that, so a general overview of all this would be amazing!
Any help I can get understanding how the above items work and why would be great!
Thanks.
Your questions is rather 'general'. So the best I can think of is point you to definitive resources on the topic [which may or may not satisfy you].
1: The TLDP book Bash Guide for Beginners, especially Chapter 3 on The Bash environment which talks about PATH and the bash configuration files you mentioned.
2: The Filesystem Hierarchy Standard which basically sets out requirements for how a UNIX(like) Operating System's filesystem should be laid out. The section on /usr goes into considerable detail.
And in case those links go down in the future, here is the gist of what they say about your specific questions:
1: PATH is basically an environment variable, which contains a ':' separated list of directories. When you type a command in Bash, Bash will go through the directories (in the order they are listed) listed in PATH to search for an executable file corresponding to the command. You can see the current contents of PATH by executing:
echo $PATH
in your terminal.
2: /usr contains files/packages installed by your distribution. In my case [I use 'Archlinux'], this means packages which get installed when I install Archlinux, or which I can choose to install via the official package manager for Archlinux. In your case, I guess this means stuff that came along with Mac OS X, officially packaged by Apple.
/usr/local is where things get installed when I locally install packages [bypassing the package management system]. e.g. if I want the latest copy of GCC, I download the sources, build it for myself, and then when I execute 'make install' it goes into /usr/local. But the 'official' copy of GCC that comes with Archlinux goes into /usr. And when that official copy gets updated, my own copy in /usr/local is untouched.
So on a freshly installed system [e.g. a spanking new MacBook], /usr/local should be empty. Because the local administrator (you) has installed nothing yet.
Related
With macOS High Sierra a new file system is available: APFS.
This file system supports clone operations for files: No data duplication on storage.
cp command has a flag (-c) that enables cloning in Terminal (shell).
But I didn't find a way to identify theses cloned files after.
Somebody knows how to identify cloned files with a shell command, or a flag in a existent command, like ls?
After 3 years and 2 months... I received a lot of points because of this question here on stackoverflow.
So yesterday I decided to revisit this topic :).
Using fcntl and F_LOG2PHYS is possible to check if files are using same physical blocks or not.
So I made an utility using this idea and put it on github (https://github.com/dyorgio/apfs-clone-checker).
It is only the first release guys, but I hope that the community can improve it.
Now maybe a good tool to remove duplicated files using clone APFS feature can be born. >:)
The command you have used, is not a feature of APFS-Filesystem. The CP -c command calls a function named "clonefile" which is part of bsd since 2015 (s. Man-Page)
http://www.manpagez.com/man/2/clonefile/
So if you clone a file for example, you can change attributes from Original and the Clone can have diffrent Attributs.
I think, the Feature, you are searching for is build in per Copy and Write. You can see the different, if you make a clone with Time Machine.
A have not found a commando per Terminal today, to show this differences, but the clonefile command therefore is not the right function.
The only Known-Way today to Show changed Attributes in Clones is Apple Time Machine Backup Solution.
It`s a Snapshot Solution. Something about this, in this Apple Dev Support-Case:
https://forums.developer.apple.com/thread/81171
I think this is meant to be an internal proprietary feature of APFS that you are not supposed to be playing with. It strikes me as a relatively useless feature. If you want to have two files that are the same and use standard APIs, try either hard or soft links, or else Apple aliases.
at work we have a central, read-only, Linux Anaconda installation, and several projects need library packages for their individual project members.
Is there a way to conda install packages in a writable area set aside for each project?
Our Linux servers are also not directly web connected, but we can transfer data from a Windows machine that is. Is there a way for the windows conda to download data for our Linux install in such a way that I can transfer the downloaded files to Linux and then finish the install on Linux , with the conda linux not needing a direct web connection?
Thanks in advance :-)
The best answer to this question is a bit oblique: the Anaconda Distribution is designed for a single user on a single system with unrestricted access to the Internet. Any other use is considered "off label" and YMMV, though there are no license restrictions in place preventing you from trying to use it as you see fit. Anaconda Enterprise is the commercial product that is specifically designed for multi-user, server-deployed Anaconda with firewall restrictions. Security, governance, indemnification, support, collaboration, etc. etc. Check out https://www.continuum.io/ for more details.
But there are "work around" ways to achieve what you want, albeit complicated ones. For it to be reliable, reproducible, and maintainable you're going to end up reimplementing a lot of what is in Anaconda Enterprsie. Here are some tips:
Check out the "conda in multi-user environments" documentation
Check out the "Centralized Anaconda installation" documentation
Regular user alice for project foo can do conda create -p /nfs/project/foo/envs/custompython --offline anaconda; conda activate /nfs/project/foo/envs/custompython; conda install pkg1 pkg2 pkg3
You're going to run into ownership/permission issues. If you have sensible umask values then when alice's colleague bob tries to update pkg2 in the foo project he'll discover that he can't unlink the files alice wrote there. There is stuff you can do (as the IT admin) with chown, or alice can do with chmod, but its all a bit of a bother and there are lots of ways you can paralyze a conda environment because it is expecting "writability" to be binary for a particular environment. There is a long history in the conda GH issue tracker of people (myself included) shooting themselves in the foot by starting a conda env setup with one account and then making mods with another account that bork out half way through, leaving everything inconsistent.
Be careful about .condarc files. My advice: avoid them everywhere but in the base Anaconda installation (say, inside /opt/anaconda/.condarc). All sorts of weird stuff can happen when multiple overlaying .condarc files come together (the docs reference above discusses this).
People can create their own environments in an "offline" mode so long as the packages specified in those new environments (and their dependencies) are a subset of the packages available in the base environment (or subsequently added to the package cache), taking into account versions as well, of course.
You can download packages using your online Windows machine by grabbing them from repo.continuum.io and from anaconda.org. Make sure you download them for the right platform. But the challenge: you need to download a set of packages that will satisfy the dependencies of the package you want to install. There isn't a super easy way to get that information when you're offline.
Once you drop new packages into the Linux system's package cache be sure to re-run conda index.
Beware installing packages directly from their tarballs: this will not pick up any dependencies and does what is called a "force" install. So doing conda install /path/to/conda/pkg-ver.tar.bz2 is actually most similar to doing conda install --force --no-deps pkg=ver (though not identical, to be sure). --force means the install will happen NO MATTER WHAT, even if it will break your environment (violate existing package dependencies), and --no-deps means you won't get any of the dependencies of pkg installed.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
This isn't so much a "question" as a methodology I found which I believe is working.
Most servers use the path "/usr/bin/perl" ... but Strawberry Perl (strawberryperl.com) use their own unique path of "/strawberry/perl/bin" (!!) (I tried installing into a different directory as allowed by the prompt, but it wouldn't work at all then! I read somewhere that some files within the installation are 'hardcoded' to the above path.)
I am not looking forward to having to rename all the shebangs of around 400 offline files, and then having to change them all again when uploaded, and I sought another solution. I found it in something called a "symbolic link".
Basically, it's an internal Windows redirect. It basically says "If you see the path as 'usr/bin/perl' then instead go to 'strawberry/perl/bin' " There are two ways to set this up.
The first is to open up a command line terminal ("CMD" in Windows search box, then click "cmd.exe") You use "cd.." to get back to the "C:>" prompt, and then enter "/d usr\bin\perl starwberry\perl\bin\perl.exe" and click enter. This will set up the <==> symbolic link. (Note directions of the slashes) That's OK for a one time use. (It may work without adding ".exe", but to be sure...)
But I design websites offline, so I need the redirect to be set up each time I boot up. You can do this as well with a batch file.
Using a text file, enter the same data as you did at the prompt, and save it as a ".bat" file to your startup folder, (as found in the left menu when clicking "Start" button lower left) You may well find other icons for programs that also initiate at startup within this folder.
I'm 99% certain this is working, because I went into the 'usr/bin/perl' and renamed the executable files as 'perl_old.exe' and 'perl_5.12.4_old.exe" and "wperl_old.exe" (so that if a Perl script DID access "usr\bin\perl" it wouldn't find any program to run) ... and the file still ran when I put URL into the browser.
So why the switch from ActiveState? I wanted to install a particular library. I tried it via PPM and was told I didn't have authorisation. No, this isn't an "Administrator Rights" issue of Windows; it's the fact that ActiveState now want to charge $999 for access to certain files. "Well, you can still use 'dmake' to create the files downloaded direct from CPAN" Er, no, you can't ... because "dmake" is one of the files under lock and key! And without that, you cannot install ANY file from CPAN. (The term "Holding You To Ransom" springs to mind.)
Using Strawberry Perl, it's just a case of starting a command line terminal, (CMD) moving back to the root (C:>) and typing "cpan". You now type "install MODULE::name". Boom! All the files for that particular module are downloaded and installed using the "make.pl" associated with that program.
We won't get into the debate of a company charging to access items in the public domain; they're a business after all.
I know this might be teaching your grandmother to such eggs to some of the more advanced users, but there may be other people on the verge of renaming all their files when switching to Strawberry Perl. Oh, I believe their program suite also include C, C++ and Fortran compilers (no, I've no idea either!). One downside: Due to all the extra program features they install, the directory is THREE TIMES LARGER than the "ActiveState" installation!
I'm pretty sure your problem with ActivePerl is that you're using an older version. I've just done:
C:\Users\myaccount\Documents>perl -MCPAN -e shell
It looks like you don't have a C compiler and make utility installed. Trying
to install dmake and the MinGW GCC compiler using the Perl Package Manager.
This may take a a few minutes...
Downloading ActiveState Package Repository dbimage...done
Downloading MinGW-4.6.3...done
Downloading dmake-4.11.20080107...done
Unpacking MinGW-4.6.3...done
Unpacking dmake-4.11.20080107...done
Generating HTML for MinGW-4.6.3...done
Generating HTML for dmake-4.11.20080107...done
Updating files in site area...done
2759 files installed
Please use the `dmake` program to run commands from a Makefile!
cpan shell -- CPAN exploration and modules installation (v2.05)
Enter 'h' for help.
cpan>
Using version:
This is perl 5, version 20, subversion 1 (v5.20.1) built for MSWin32-x86-multi-thread-64int
ActiveState has a policy of not keeping fully up to date on older versions, because of the support overhead. You can see - for example - their builds of dmake here:
https://code.activestate.com/ppm/dmake/
From their web page:
Looking for access to older versions of ActivePerl?
Community Edition offers access to the newest versions of ActivePerl.
Access to older versions (Perl 5.6, 5.8, 5.10, 5.12, 5.14, 5.16) is available in Business Edition and Enterprise Edition.
E.g. to use the version you're currently using (5.12), you'd need to buy support. But you could use 5.18 or 5.20 for free.
I would also note: Windows doesn't use shebang paths anyway; it uses file associations.
I've been installing programs with chocolatey, but it's not adding them to my path automatically. Does anyone know a solution? I just followed the install instruction on Chocolatey's front page, and everything works well. The programs just aren't being added to the path.
It depends on what you install, and whether those native installers add themselves to the path in some cases.
If the package maintainer doesn't take the extra step in the cases where the installer doesn't add a program folder to the PATH, then those items may not be available on the command line.
The other side of this is that those items may be in PATH, but not to your current shell (cmd/powershell/whatever). This is due to how Windows works versus terminal in *nix. We've made some improvements there but it's not perfect. Expect things to get better over time in that aspect.
We have one issue out for ensuring that we create the User PATH correctly in the registry. This might be what is causing the issue for any items that may be adding themselves to this PATH instead of the system PATH.
Is it possible to install the entire database(postgresql8.2) via command prompt or batch file or registry file bypassing the trivial procedure for installation. But then to a question comes that, how can we supply default parameters such as name,password,language,default location of database? Currently I'm working on 'Windows XP' platform.
Thank you.
For 8.3 and lower the obvious answer is: http://pginstaller.projects.pgfoundry.org/ which supports or supported silent installations. For more recent versions, please read: http://forums.enterprisedb.com/posts/list/2135.page
Use of existing installers would simplify your life and be where I would start.
This being said there is no reason you can't generate a script to register dll's properly run initdb, etc. This will take some extra knowledge of both PostgreSQL and Windows, and will be mostly suitable for custom solutions (i.e. not cases where you merely are packaging software that runs with PostgreSQL). I don't think an complete answer can be given here because once you need such a solution you need to design your installation around if. Books could be written on that topic. The docs http://www.postgresql.org/docs/9.0/static/install-windows.html should get you started however since the only difference really between installing from source and installing from the precompiled source is just that you need to compile the source files first.
Failing that you could take a look at the binary zip packages. Typically these can be extracted and PostgreSQL can be run from inside them.