Installing a bash program on mac - linux

Hi all I am trying to install a bash program called objconv which converts object files between different architectures on my macbook air. I have so far followed the instructions but when I successfully install the script file and attempt to the command for the program terminal gives me the error -bash: objconv: command not found I have tried everything I know to fix it but nothing has worked. I also installed homebrew using instructions on a thread on this website. I currently have version 4.3.___ installed. I have my bash directory set to this /usr/local/bin/bash
as per the homebrew instructions stated and I have stated in the top of the build.sh file like: #!/usr/local/bin/bash.
This is the download to the objconv file which as the instructions:
http://www.agner.org/optimize/objconv.zip
Here is the pdf file with the instructions please refer to page 4:
http://www.agner.org/optimize/objconv-instructions.pdf

I don't know the objconv tool, but it seems as though bash simply cannot find it wherever you have installed it. That means your PATH is probably wrong because that tells bash where programs are to be found.
So, first, you need to find objconv, and I am guessing you are unsure where it is. Let's try looking in /usr/local like this
find /usr/local -name objconv -type f
and if that doesn't work, broaden your search to the whole of /usr like this
find /usr -name objconv -type f
and if that doesn't work, try searching your entire Mac, like this, which will be slower
sudo find / -name objconv -type f 2> /dev/null
The outpt of the above search(es) will be like
/usr/local/bin/bash/objconv
which would mean that the objconv program is in the directory /usr/local/bin/bash.
If you now want to run it, you can either type
/usr/local/bin/bash/objconv [something] ... <something>
or, if that is too long-winded, edit your bash profile in $HOME/.profile and change the line that sets the PATH so it looks like:
export PATH=WhereverObjconvLives:$PATH
Then activate the new PATH using:
source $HOME/.profile

Related

Location of .bashrc for "Bash on Ubuntu on Windows" in Windows 10

Microsoft just introduced a Linux subsystem in its Windows 10 Anniversary Edition. The installation is pretty straight forward, but I could not locate bash files on Windows.
How does it work? What does ~ refer to in Windows? Where to find .bashrc?
Since the Windows 10 Fall Creators Update, the location changed to:
C:\Users\USERNAME\AppData\Local\Packages\{DIST}\LocalState\rootfs\home\{LINUXUSER}\
Where:
{DIST} is equal to CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc
{LINUXUSER} is the user for which you are looking for the .bashrc file
Just for anyone wondering that came here from Google.
Sorry for the misunderstanding, I check on google and it will be at C:\Users\USERNAME\AppData\Local\Lxss\home\USERNAME .
I tried and it works, in the cmd just type cd\ && dir *bashrc* /s it will locate the file, and in my case i see the line C:\Users\USERNAME\AppData\Local\Lxss\home\USERNAME but when I want to navigate it with the window browser it doesn't work, but if you copy paste it, it works :-)
I found it here.
Considering that you need to know where a file is located you can use the find command.
The syntax of the command is find {search-path} {file-names-to-search} {action-to-take}by default the action to take is printing the file name.
So if you are finding .bashrc file you can use find / -name .bashrc the bash will return you /home/yourusername/.bashrc
Also, if you want to access to your home directory you can use cd ~
Hope my answer will be helpful :-)
just type
vi ~/.bashrc
and that should put you into the file where ever it is.
You can navigate there simply by doing cd ~
List all files with ls -a and you should be able to see it.
~ means that is user home folder, way like /home/%username%/
you can list files like ls -al and see .bashrc file.
Right now on WSL 2 you can find it under /home/{user_name} and the file is hidden.
You can access it from Ubuntu console by {text_editor} .bashrc
If you want to edit that in Windows just type in ubuntu console explorer.exe . and it opens the current folder and shows all hidden files.
It's weird but works fine.
Other answers doesn't work for me using WSL 2.
The LocalState folder contains a virtual disk so rootfs does not exist,
and AppData\Local folder does not have the Lxss folder.
The solution for me is surprisingly simple:
wsl -u root
This will allow you to get into wsl as root.
From here, you have access to the whole linux.
Fix the .bashrc or anything you want.
Don't screw up the root user. :)
I find my .bashrc file in:
/home/your_user_name
you can run cd /home/your_user_name or cd ~ should work as well
If you previously installed git bash for window, you may also find .bashrc file in your window user profile folder. In Linux subsystem, you may local the file under /mnt/c/Users/your_window_user_name/.bashrc However, modifying that file only works for git bash in window but not for the shell terminal of the Linux subsystem.
Note: my installation of the Ubuntu is 20.04 LTS straight from window store.

Find command not working as expected in centOS

I am using CentOS Linux release 7.0.1406 on virtual box. I am trying to find the files using find command.
this find command is not giving any response:
find . -name "orm.properties"
My current working directory is /eserver6. File orm.properties is present in /eserver6/share/system/config/cluster, but find command is not able to find the file.
I have tried other combinations like
find . -name "orm.*"
find . -name 'orm*'
this is finding few files staring with orm but not all the files present inside the current working directory.
The command line looks correct and it should find the file. Some reasons why it might fail:
You don't have permission to enter one of the folders in the path to /eserver6/share/system/config/cluster.
You made a typo
The file system is remote and the remote file system behaves oddly
There is a simlink somewhere in the path. By default, find doesn't follow symlinks to avoid recursive loops. Use find /eserver6 -L ... to tell find to look at the target of the link and follow it if it's a folder.
The command
find /eserver6 -name "orm.properties"
should definitely find the file, no matter where you are. If it doesn't, look at -D debugoptions in the manpage. You probably want -D stat to see at which files find looks and what it sees.
If your user have entry into sudoers file then its ok and you can run
sudo find / -name "orm.properties"
or else ask your admin to give an entry in sudoers file of your user and run the same command then it will work.

Where can I find .curlrc file on UBUNTU?

Where can i find the .curlrc file? I have tried $HOME/ and echo $CURL_HOME gives me a blank line. I have also tried find . -name ".curlrc" in $HOME. No results.
Please help
updatedb && locate curlrc
make sure you run this command as root
or you could...
nano ~/.curlrc
This is where it should be.
I do believe by default though, there is no curlrc file. You might have to create your own
Try,
find / -name .curlrc
this will output all .curlrc files and you can choose whichever is required.

Path, /usr/bin/ and /usr/local/bin/

I installed watchr on OS X (10.8.3) using gem install watchr. And it's installed in /usr/bin/watchr
$ which watchr
/usr/bin/watchr
However, when I tried to call it $ watchr -v, the system couldn't find it.
$ watchr -v
-bash: /usr/local/bin/watchr: No such file or directory
I think this is related to how the path is set up on my machine. My questions:
What is the right way to fix it?
In general, what programs should go to /usr/bin/ vs. /usr/local/bin/?
When I do e.g. $ /usr/bin/watchr -e 'watch(./hello.txt) ...', are we looking at the hello.txt in the current directory or in /usr/bin/ i.e. the same directory as watchr?
The path to your command was cached with a bad value. Try to update the cached directory that bash has stored for the path.
hash -d watchr
I found the answer over here which ctags shows /usr/local/bin/ctags but when I run ctags it runs /usr/bin/ctags. How is this possible?
Is /usr/local/bin/watchr a broken symlink? That would make which watchr not include it but watchr would print this error:
-bash: /usr/local/bin/watchr: No such file or directory
I don't know why the gem that comes with OS X installs programs in /usr/bin/, but generally /usr/bin/ is meant for preinstalled programs, and package managers use something like /opt/local/bin/ or /usr/local/bin/.
I also have /usr/local/bin/ before other folders on the path, and I put most programs that I install or compile manually to /usr/local/bin/. I used to have a separate ~/bin/ folder, but it's easy to find non-Homebrew programs with something like find /usr/local/bin ! -lname '../Cellar/*'.
Related questions about /usr/local/bin/ in general:
https://unix.stackexchange.com/questions/8656/usr-bin-vs-usr-local-bin-on-linux
https://unix.stackexchange.com/questions/4186/what-is-usr-local-bin-came-across-it-in-an-script-installation-for-applescript
create a file called .profile in your home directory and add the following line.
export PATH=“/usr/local/bin:/usr/local/sbin:/usr/bin:$PATH”

When executing a .run file in Linux, how to find out what will be installed or how to find out what was installed afterwards?

I wonder if it's possible to find out in some way what was installed after I ran a .run file under Linux? Or maybe there is a tool that scans a .run in order to find out whats inside it?
I need this because I'd like to install the software bundled in this .run with aptitude in order to keep it up to date. But the bundle is just available as a .run file.
Does anyone now how to do the trick?
Well you can do something like
setting up a secure chroot (or virtualmachine) environment (Google for that), and install in that.
do something like
find / > ORIGINAL_STATE -exec ls -lc \{\} \;
./INSTALLER.RUN
find / > AFTER_INSTALL -exec ls -lc \{\} \;
diff ORIGINAL_STATE AFTER_INSTALL
A lot of .run files (or other binary installation files) I have seen are regular scripts with a binary part in them. This means you can open them with a text editor and inspect the first few lines (open with less rather than a gui editor so it doesn't get stuck on the binary part).

Resources