.bash_profile# file is opening in vim when i am opening Terminal - macos

Whenever I am opening Terminal, ~/.bash_profile# file is opening in VIM.
When I clicked 2+ctrl+g i am getting below file details
buf 1: "~/.bash_profile#" line 1 of 6 --16%-- col 1 (1 of 8)
Tried from Vim Ex mode loads when opening terminal where I am getting
Roys-Air:Desktop username$ ls -altr $HOME | tail
-rw------- 1 username staff 12288 Jul 10 01:26 .swo
-rw-r--r-- 1 username staff 12288 Jul 10 01:27 .bash_profile#.swp
-rw-r--r-- 1 username staff 0 Jul 10 01:29 .bashrc
drwxr-xr-x 4 username staff 128 Jul 10 01:38 private
-rw-r--r--# 1 username staff 14340 Jul 10 01:38 .DS_Store
-rw------- 1 username staff 9986 Jul 10 01:40 .bash_history
-rw-r--r-- 1 username staff 5 Jul 10 01:40 .bash_profile#
-rw------- 1 username staff 8402 Jul 10 01:40 .viminfo
drwxr-xr-x+ 52 username staff 1664 Jul 10 01:40 .
drwx------ 81 username staff 2592 Jul 10 01:40 .bash_sessions
I am expecting terminal should open like Roys-Air:~ UserName$
.bash_profile is containing below content
# Setting PATH for Python 3.7
# The original version is saved in .bash_profile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/3.7/bin:${PATH}"
export PATH
export MONGO_PATH=/usr/local/mongodb
export PATH=$PATH:$MONGO_PATH/bin
##
# Your previous /Users/rajnikantroy/.bash_profile file was backed up as /Users/rajnikantroy/.bash_profile.macports-saved_2018-12-07_at_02:06:08
##
# MacPorts Installer addition on 2018-12-07_at_02:06:08: adding an appropriate PATH variable for use with MacPorts.
export PATH="/opt/local/bin:/opt/local/sbin:$PATH"
# Finished adapting your PATH environment variable for use with MacPorts.
# Setting PATH for Python 3.7
vim .bash_profile# The original version is saved in .bash_profile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/3.7/bin:${PATH}"
export PATH
export ANT_HOME=/Users/rajnikantroy/Documents/ant/apache-ant-1.10.6/
export PATH=$PATH:$ANT_HOME/bin

Edit your bash profile and correct the line starting with vim .bash_profile. In vim:
:/vim .bash_profile/normal! 0dt#

Related

Reset/Remove .bash file versions

New to this and I believe I made duplicates or versions of the .bash_profile. I'd like to know how to make one the priority or delete those that are not active. I think its interfering with my SQL communication.
-rw------- 1 noahjones staff 2342 Sep 3 18:33 .bash_history
-rw-r--r-- 1 noahjones staff 157 Sep 3 18:31 .bash_profile
-rw------- 1 noahjones staff 201 Sep 3 18:29 .bash_profile.save
-rw-r--r-- 1 noahjones staff 74 Sep 3 16:33 .bash_profile_
drwx------ 48 noahjones staff 1536 Sep 3 18:34 .bash_sessions
-rw-r--r-- 1 noahjones staff 118 Sep 3 15:38 .bashrc
drwxr-xr-x 3 noahjones staff 96 Sep 3 16:01 .bundle
drwxr-xr-x 4 noahjones staff 128 Sep 3 15:40 .gem
-rw-r--r-- 1 noahjones staff 74 Sep 3 18:33 _bash.profile
Only the .bashrc and /.bash_profile are relevant. The file .bash_history is created automatically to store the history of your commands; the .bash_profile.save, .bash_profile_ and _bash.profile must be your backup files -- they are virtually ignored. The .bundle and .gem are not related to bash.
You probably have .bashrc and/or .bash_profile misconfigured. The difference between .bash_profile and .bashrc is that the former is only executed once, when you log in, while the latter is run every time you open a new /bin/bash shell. Depending on what you need to do with SQL you may want to delete one or the other.

How to remove the static message that appears when opening a Linux shell?

How to remove the following message:
To run a command as administrator (user "root"), use "sudo ".
See "man sudo_root" for details.
Every time I open a Terminal it appears. I upgraded from Ubuntu 14.04 LTS to 16.04 LTS and it seems that update made that.
I am using bash.
I googled that and found this command:
$ touch ~/.hushlogin
Execute the below command and close the terminal. The message will be remove from the terminal.
sudo apt-get update
atleast my ubuntu 14.04 machine will display(or run) all the script in /etc/update-motd.d(motd => message of the day) directory.
ll /etc/update-motd.d/
total 40
drwxr-xr-x 2 root root 4096 Sep 27 2014 ./
drwxr-xr-x 109 root root 4096 Nov 30 10:27 ../
-rwxr-xr-x 1 root root 1220 Feb 20 2014 00-header*
-rwxr-xr-x 1 root root 1358 Feb 20 2014 10-help-text*
lrwxrwxrwx 1 root root 46 Sep 27 2014 50-landscape-sysinfo -> /usr/share/landscape/landscape-sysinfo.wrapper*
-rwxr-xr-x 1 root root 334 Sep 27 2014 51-cloudguest*
-rwxr-xr-x 1 root root 149 Aug 22 2011 90-updates-available*
-rwxr-xr-x 1 root root 299 Aug 21 2014 91-release-upgrade*
-rwxr-xr-x 1 root root 111 Mar 27 2014 97-overlayroot*
-rwxr-xr-x 1 root root 142 Aug 22 2011 98-fsck-at-reboot*
-rwxr-xr-x 1 root root 144 Aug 22 2011 98-reboot-required*
The scipt with lowest number is gonna execute first 00-header*

Where is locale_gen localted on FreeBSD?

I have only two locales installed
$ locale -a
C
POSIX
I want to use utf-8 character encoding and hence want to install en_US.UTF-8
For ubuntu I found locale_gen which does the job. Is this utility, or any similar utility present for FreeBSD? If yes, could you please tell me its location? Thanks
I followed this guide to install UTF-8 locale. This is how it looks like in my terminal once that's set up:
g#crayon2:~ % locale
LANG=en_GB.UTF-8
LC_CTYPE="en_GB.UTF-8"
LC_COLLATE="en_GB.UTF-8"
LC_TIME="en_GB.UTF-8"
LC_NUMERIC="en_GB.UTF-8"
LC_MONETARY="en_GB.UTF-8"
LC_MESSAGES="en_GB.UTF-8"
LC_ALL=
Copying from there this is what I changed:
/etc/login.conf
--- login.conf.default 2012-01-02 17:08:05.804291477 -0500
+++ login.conf 2012-01-02 17:08:16.996213774 -0500
## -44,7 +44,9 ##
\:pseudoterminals=unlimited:\
\:priority=0:\
\:ignoretime#:\
- \:umask=022:
+ \:umask=022:\
+ \:charset=UTF-8:\
+ \:lang=en_US.UTF-8:
Rebuild the login database with cap_mkdb /etc/login.conf after making changes.
/etc/profile
LANG=en_US.UTF-8; export LANG
CHARSET=UTF-8; export CHARSET
GDM_LANG=en_US.UTF-8; export GDM_LANG
Of course I used en_GB rather than en_US as you can tell.
Edit:
The locale files are located in /usr/share/locale:
g#crayon2:/usr/share/locale % ls -l
total 1423
drwxr-xr-x 2 root wheel 3 11 Nov 2014 UTF-8
drwxr-xr-x 2 root wheel 8 11 Nov 2014 af_ZA.ISO8859-1
drwxr-xr-x 2 root wheel 8 11 Nov 2014 af_ZA.ISO8859-15
drwxr-xr-x 2 root wheel 8 11 Nov 2014 af_ZA.UTF-8
drwxr-xr-x 2 root wheel 8 11 Nov 2014 am_ET.UTF-8
drwxr-xr-x 2 root wheel 8 11 Nov 2014 be_BY.CP1131
drwxr-xr-x 2 root wheel 8 11 Nov 2014 be_BY.CP1251
drwxr-xr-x 2 root wheel 8 11 Nov 2014 be_BY.ISO8859-5
(..)
These files are not part of any port, they are part of the base.txz archive available from the FreeBSD ftp server:
g#crayon2:~/Downloads % tar -tzf base.txz | grep "usr/share/locale"
./usr/share/locale/
./usr/share/locale/lt_LT.ISO8859-4/
./usr/share/locale/en_GB.ISO8859-15/
./usr/share/locale/kk_KZ.PT154/
./usr/share/locale/it_IT.ISO8859-15/
./usr/share/locale/hy_AM.UTF-8/
./usr/share/locale/en_IE.UTF-8/
./usr/share/locale/zh_HK.UTF-8/
./usr/share/locale/en_AU.ISO8859-1/
./usr/share/locale/zh_CN.eucCN/
./usr/share/locale/fr_BE.ISO8859-15/
./usr/share/locale/en_AU.UTF-8/
(...)

Installing Torch7. iPython installation error (mac)

I'm trying to install Torch7 on my mac, however the installation halts at this point:
Not updating your shell profile.
You might want to
add the following lines to your shell profile:
export PATH=/Users/khsiddiqui/torch/install/bin:$PATH
export LD_LIBRARY_PATH=/Users/khsiddiqui/torch/install/lib:$LD_LIBRARY_PATH
export DYLD_LIBRARY_PATH=/Users/khsiddiqui/torch/install/lib:$DYLD_LIBRARY_PATH
Not sure what it means. Further above I received the following output
echo "Error: could not find ipython in PATH. Do you have it installed?"
fi
However iPython is installed as I can confirm:
No update necessary, 'ipython' is up-to-date.
ipython-3.0.0-3.egg was installed on: Thu Apr 9 18:12:32 2015
kamransiquisMBP:torch khsiddiqui$ env | grep PATH
PATH=/Users/khsiddiqui/Library/Enthought/Canopy_64bit/User/bin:
/usr/local/bin:
/usr/bin:
/bin:
/usr/sbin:
/sbin:
/opt/X11/bin:
/usr/texbin
Attempting to locate the .bashrc file
%edit .bashrc
WARNING: Argument given (.bashrc) can't be found as a variable or as a filename.
kamransiquisMBP:torch khsiddiqui$ ls -ld ~/.*
drwxr-xr-x+ 43 khsiddiqui staff 1462 12 Apr 01:15 /Users/khsiddiqui/.
drwxr-xr-x 6 root admin 204 19 Oct 17:34 /Users/khsiddiqui/..
-r-------- 1 khsiddiqui staff 7 19 Oct 17:34 /Users/khsiddiqui/.CFUserTextEncoding
-rw-r--r--# 1 khsiddiqui staff 16388 26 Mar 23:59 /Users/khsiddiqui/.DS_Store
drwxr-xr-x 3 khsiddiqui staff 102 8 Sep 2014 /Users/khsiddiqui/.R
-rw-r--r-- 1 khsiddiqui staff 728832 2 Apr 17:21 /Users/khsiddiqui/.RData
-rw-r--r-- 1 khsiddiqui staff 1101 20 Oct 02:58 /Users/khsiddiqui/.Rapp.history
-rw-r--r-- 1 khsiddiqui staff 6314 2 Apr 17:21 /Users/khsiddiqui/.Rhistory
drwx------ 22 khsiddiqui staff 748 12 Apr 01:25 /Users/khsiddiqui/.Trash
-rw------- 1 khsiddiqui staff 1860 9 Apr 22:15 /Users/khsiddiqui/.bash_history
drwxr-xr-x 4 khsiddiqui staff 136 9 Apr 17:57 /Users/khsiddiqui/.cache
drwx------ 18 khsiddiqui staff 612 12 Apr 20:09 /Users/khsiddiqui/.canopy
drwxr-xr-x 3 khsiddiqui staff 102 12 Apr 01:15 /Users/khsiddiqui/.conda
drwxr-xr-x 2 khsiddiqui staff 68 12 Apr 01:11 /Users/khsiddiqui/.continuum
drwx------ 3 khsiddiqui staff 102 30 Jul 2010 /Users/khsiddiqui/.cups
drwx------ 10 khsiddiqui staff 340 2 Apr 17:26 /Users/khsiddiqui/.dropbox
-rw-r--r-- 1 khsiddiqui staff 2525 12 Apr 16:56 /Users/khsiddiqui/.enstaller4rc
drwxr-xr-x 9 khsiddiqui staff 306 9 Apr 22:25 /Users/khsiddiqui/.ipython
drwxr-xr-x 4 khsiddiqui staff 136 12 Apr 16:57 /Users/khsiddiqui/.matplotlib
-rw-r--r-- 1 khsiddiqui staff 340 12 Apr 01:12 /Users/khsiddiqui/.profile
-rw-r--r-- 1 khsiddiqui staff 251 28 Mar 13:45 /Users/khsiddiqui/.profile-anaconda.bak
drwxr-xr-x 15 khsiddiqui staff 510 2 Apr 17:21 /Users/khsiddiqui/.rstudio-desktop
drwxr-xr-x 6 khsiddiqui staff 204 20 Oct 19:21 /Users/khsiddiqui/.subversion
-rw------- 1 khsiddiqui staff 625 9 Apr 21:33 /Users/khsiddiqui/.viminfo
i had a similar problem and solved it, maybe it could help others.
Here was the end of the second installation script, and the command "th" wasn't working:
Not updating your shell profile.
You might want to
add the following lines to your shell profile:
. /Users/myusername/torch/install/bin/torch-activate
This article explains how your shell profile is organized: https://serverfault.com/questions/110065/what-profile-is-my-current-shell-using
I realized in my user folder /Users/myusername/ i had a ".bash_profile" file, i pasted the line ". /Users/myusername/torch/install/bin/torch-activate" inside but didn't work (command "th" no recognized in terminal).
So in the same /Users/myusername/ folder i created a ".profile" file and pasted the line ". /Users/myusername/torch/install/bin/torch-activate" inside.
Then the command "th" works fine ;)
First, IPython may be installed but not seen by the install process.
If you enter which ipython at a shell prompt it will tell you where it is installed. Then echo $PATH will display your PATH variable which should contain the directory that contains IPython. If it isn't then you will have to edit the PATH statement in your .bashrc file to add it.
Second, .bashrc is a file that is run by the shell when it starts up and should be in your home directory so enter cd at a shell prompt and you will be there. Then use a text editor such as Text Edit to edit it. In your case you don't have a .bashrc file, instead some things are being set in a file called .profile. You should probably check the contents of that.
Finally, I wouldn't run any of these commands from within IPython. Only run them (and the Torch install process) from the shell.
Further, I notice you have a file with the name "anaconda" in it. Have you installed 'Anaconda'?

Why does directory vanish when I do SSHFS? How to setup SSHFS share on Max OSX 10.9?

I'm running Max OSX 10.9.3 and I'm trying to setup an SSHFS file-share between my MacBook Pro and a remote file system. However, when I try to do it, it doesn't work.
Strangely enough, it makes the target directory disappear. Has anyone else seen this happen? Is it a bug?
First see that I can ssh normally into the target machine:
% ssh remoteuser#XXX.XXX.XXX.XXX # <--- SSH to remote system works! See below.
remoteuser#XXX.XXX.XXX.XXX % ls -altr remoteDir
total 8
drwxr-xr-x 26 remoteuser remoteuser 4096 Jun 22 01:00 ..
drwxrwxrwx 2 remoteuser remoteuser 4096 Jun 22 01:08 .
remoteuser#XXX.XXX.XXX.XXX % exit
% # <--- Logged out of remote system
Next, I create a directory locally and verify it was created:
% pwd
/mnt
% ls
total 0
drwxr-xr-x 31 root admin 1122 Jun 18 18:34 ../
drwxr-xr-x 2 root admin 68 Jun 23 08:11 ./
% sudo mkdir share1
% ls
drwxr-xr-x 31 root admin 1122 Jun 18 18:34 ../
drwxr-xr-x 4 root admin 136 Jun 23 08:50 ./
drwxr-xr-x 2 root admin 68 Jun 23 08:50 share/
Now I try to setup the SSHFS share:
% sudo sshfs remoteuser#XXX.XXX.XXX.XXX:remoteDir /mnt/share1
remoteuser#XXX.XXX.XXX.XXX's password:
%
Ok. It seems to have worked. No errors. So let's see the share we created, shall we?
% ls
ls: share1: No such file or directory
total 0
drwxr-xr-x 31 root admin 1122 Jun 18 18:34 ../
drwxr-xr-x 3 root admin 102 Jun 23 08:12 ./
What? Not only is the File Sharing not working, but the share1 directory seems to have vanished! (Although the file system seems to know it is missing, which is weird).
Where did /mnt/share1 go and how do I setup this SSHFS?
SSHFS doesn't come with OS X AFAIK, so you should mention how you installed it. But I'm guessing sshfs is designed to be used with fstab or mount rather than be called directly. Try something like:
mount -t sshfs remoteuser#XXX.XXX.XXX.XXX:remoteDir /mnt/share1

Resources