The server manager told me they updated/built vim to the latest version at /opt/vim/src/vim but when I open $vim, it is still the old version. Then I check:
$which vim
/usr/bin/vim
My question is how to set or change $PATH so that I will initiate the latest vim version?
Here is the OS information:
~$ uname -a
Linux ccis4301 3.13.0-88-generic #135-Ubuntu SMP Wed Jun 8 21:10:42 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
~$ cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=14.04
DISTRIB_CODENAME=trusty
DISTRIB_DESCRIPTION="Ubuntu 14.04.5 LTS"
In your .bashrc or .zshrc set:
export PATH="/opt/vim/src:$PATH"
PATH holds the lists of dirs which are searched for binaries in order one by one. Hence, the order is important.
export PATH=$PATH:/opt/vim/src
will result in picking /usr/bin/vim.
We can override this by flipping the order
export PATH=/opt/vim/src:$PATH
and to make it permanent. Add this to your rc file like ~/.bashrc
echo 'export PATH=/opt/vim/src:$PATH' >> ~/.bashrc
source ~/.bashrc
Related
I have a simple Makefile. For some reason i is not importing PATH properly:
Here is what I get when I run echo $PATH in the terminal
/home/someuser/myfs/opt/pkg/petalinux-v2016.2-final/tools/common/petalinux/bin:/home/someuser/myfs/opt/pkg/petalinux-v2016.2-final/tools/linux-i386/petalinux/bin:/home/someuser/myfs/opt/pkg/petalinux-v2016.2-final/tools/common/petalinux/bin:/home/someuser/myfs/opt/pkg/petalinux-v2016.2-final/tools/linux-i386/microblaze-xilinx-elf/bin:/home/someuser/myfs/opt/pkg/petalinux-v2016.2-final/tools/linux-i386/microblazeel-xilinx-linux-gnu/bin:/home/someuser/myfs/opt/pkg/petalinux-v2016.2-final/tools/linux-i386/gcc-arm-none-eabi/bin:/home/someuser/myfs/opt/pkg/petalinux-v2016.2-final/tools/linux-i386/gcc-arm-linux-gnueabi/bin:/home/someuser/myfs/opt/pkg/petalinux-v2016.2-final/tools/linux-i386/aarch64-none-elf/bin:/home/someuser/myfs/opt/pkg/petalinux-v2016.2-final/tools/linux-i386/aarch64-linux-gnu/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
Here is what I get for a PATH when I run make
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin
Does anybody know what is going on?
Makefile is below and here is my system description
uname -a
4.4.0-72-generic #93~14.04.1-Ubuntu SMP Fri Mar 31 15:05:15 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 14.04.5 LTS
Release: 14.04
Codename: trusty
Makefile
.PHONY: linux bootimage fsbl dts build-dts
all: linux bootimage
dts: build-dts package bootimage
rootfs: build-rootfs package bootimage
fsbl:
petalinux-build -c bootloader
clean:
echo $(PATH)
petalinux-build -x distclean
linux:
petalinux-build
build-dts:
petalinux-build -c device-tree
build-rootfs:
petalinux-build -c rootfs
package:
petalinux-build -x package
bootimage:
petalinux-package --boot --force --fsbl ${BOOT_FSBL_IMAGE} --fpga ${BOOT_BIT_IMAGE} --u-boot=${BOOT_UBOOT_IMAGE} -o ${BOOT_IMAGE}
Here is what I get for a PATH when I run make
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin
Here your make file dont have necessary path file that needed for your programm to run.
Easiest way to do export is like this in the makefile.
export PATH := bin:$(PATH)
Perhaps, something like this.
export PATH := $(shell pwd)/bin:$(PATH)
target:
mkdir -p ./bin
export PATH
echo $(PATH)
or another approach is to export all the path variable add that to your ~/.bashrc, its done, it sets explicitly.
You can append more path using ":" ,add this line in your ~/.bashrc
export PATH=$PATH:~/your/bin1:~/your/bin2
sample example appending more path in env path :
export PATH=/opt/bin:/usr/local/bin:/usr/contrib/bin:/bin:/usr/bin:/usr/sbin:/usr/bin/X11
Information about export:
I am using a shared server on with following specificattion
Linux version 2.6.32-604.30.3.lve1.3.63.el6.x86_64
(mockbuild#build.cloudlinux.com) (gcc version 4.4.7 20120313 (Red Hat
4.4.7-16) (GCC) ) #1 SMP Sun Sep 27 06:34:10 EDT 2015
When I run date command, shown as follows. That is server's time zone is MST, that is GMT-7.
# [~]$ date Fri Apr 15 01:42:24 MST 2016
I want to run crontab on daily at 5 AM indian time[Asia/Kolkata] this server.
So set crontab as follows:
CRON_TZ=IST
0 5 * * * php my_file.php
But still the file executed in server time 5 AM, which is 12.30 hours earlier than I needed.
Hope you understand my requirement. Thanks in advance.
You could try setting the variable TZ='IST' instead of CRON_TZ='IST'. Also, After making changes to this daemon's config file you need to restart it:
service cron restart
Alternativly, In cron.conf or /etc/default/cron:
export TZ='IST'
You can use full name of indian timezone:
export TZ='Asia/Kolkata'
Just figured this out on Ubuntu 14/16. Worked perfectly for me.
Steps (sudo implied):
cat /etc/timezone
rm -fv /etc/localtime
ln -s /usr/share/zoneinfo/Asia/Kolkata /etc/localtime
apt install -y --reinstall tzdata
/etc/init.d/rsyslog restart
tail -f /var/log/syslog
cat /etc/timezone
I'd like to be able to detect which particular Linux flavor is installed on a computer, e.g. Ubuntu vs Fedora, via a command line command.
Some people recommend uname -a, but that only reports the kernel version.
Try the below command....
It worked for me...
cat /proc/version
Once you know that you are running Red Hat for example, you can get to the point with:
cat /etc/redhat-release
Or on Debian:
cat /etc/debian_version
or in general :
cat /etc/*-release
Also you could use the following command
cat /etc/issue
For displaying details including release and codename of the distro
lsb_release -a
You can try:
echo $(lsb_release -si)
Try hostnamectl. It lists the operating system, CPE OS Name, Kernel, Architecture, etc.
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 13 years ago.
Improve this question
Moved to https://superuser.com/questions/80251/how-to-know-which-linux-distribution-im-using
How to know which Linux Distribution I'm using?
uname -a gives
Linux xxxxxx.net 2.6.9-42.0.3.EL.wh1smp #1 SMP Fri Aug 14 15:48:17 MDT 2009 i686 i686 i386 GNU/Linux
How can I know this is Ubuntu/Debian/Fedora or Redhat?
I uses /etc/init.d/serviced restart for restarting serevices, seems it is not Redhat family
Update:
[~]$ cat /etc/issue
cat: /etc/issue: No such file or directory
[~]$ cat /etc/issue.net
cat: /etc/issue.net: No such file or directory
[~]$ lsb_release -a
-sh: lsb_release: command not found
[~]$ cat /etc/*-release
cat: /etc/*-release: No such file or directory
[~]$ cat /etc/*-version
cat: /etc/*-version: No such file or directory
[~]$ cat /etc/*release
cat: /etc/*release: No such file or directory
[~]$ cat /etc/*_release
cat: /etc/*_release: No such file or directory
[~]$ cat /etc/*version
cat: /etc/*version: No such file or directory
[~]$
Try this:
cat /etc/*-release
You could also try /etc/*-version
If you have lsb_release command,
lsb_release -a
will tell you (or just use lsb_release -i).
lsb_release is in Linux Standard Base Core Specification.
Edit: Looks like you're on a Red Hat system. A google search on your uname output suggests so. This is not programmatic, of course!
/etc/issue or /etc/issue.net give a good clue. Newer distros provide /etc/lsb-release which make it easier to determine exact strings progmatically, i.e. distro name / major & minor release / web site, etc.
In the absence of /etc/lsb-release, its much more difficult, hence the creation of lsb-release.
As Alok said, it looks like you are on a rather ancient (or extremely sparse) system. I don't think this is a case that you can (reliably) progmatically determine with a few lines of code.
If all else fails, check to see what kind of package manager is in use (apt / rpm / others), check to see if /etc/init.d is a symlink (rpm / RH distros) or a directory (debian based distros) .. and you have a pretty good clue as to what you can expect to be present in the root file system as far as structure.
You can't please everyone :)
Seems like here's some info:
> cat /etc/issue
Welcome to SUSE LINUX Enterprise Server 9 (i586) - Kernel \r (\l).
> uname -a
Linux boxname 2.6.5-7.244-smp #1 SMP Mon Dec 12 18:32:25 UTC 2005 i686 athlon i386 GNU/Linux
> cat /etc/*-release
SUSE LINUX Enterprise Server 9 (i586)
VERSION = 9
PATCHLEVEL = 3
A list the release filenames for the most common distros:
Release files
And a function that might help you:
Shell script
EL stands for Enterprise Linux in this case, so I think RedHat or a clone (like CentOS). I don't know a good way to programatically find out what distro you're on; there's a few different clues for each one.
cat /etc/redhat_release
cat /etc/debian_version
is a good start. (Note the Ubuntu doesn't modify /etc/debian_version when they pull changes from Debian, so my Ubuntu Karmic system has squeeze/sid in debian_version.)
Edit: forgot about lsb. Good call, Tim Post and Alok. The whole point of LSB is to give distro-independent ways to do things.
sudo find /etc | xargs grep -i fedora > searchFedora
gives:
/etc/netplug.d/netplug: # At least on Fedora Core 1
...
But see the Fedora version in the /etc/netplug.d/netplug file. Is it serious?
cat /etc/issue
Or cat /etc/fedora-release as suggested by #Bruce ONeel
You can also try /etc/redhat-release or /etc/fedora-release:
cat /etc/fedora-release
Fedora release 7 (Moonshine)
The proposed standard file is /etc/os-release. See http://www.freedesktop.org/software/systemd/man/os-release.html
You can execute something like:
$ source /etc/os-release
$ echo $ID
fedora
$ echo $VERSION_ID
17
$ echo $VERSION
17 (Beefy Miracle)
The simplest command which can give you what you need but some other good info too is:
hostnamectl
You could try
lsb_release -a
which works on at least Debian and Ubuntu (and since it's LSB, it should surely be on most of the other mainstream distros at least). http://rpmfind.net/linux/RPM/sourceforge/l/ls/lsb/lsb_release-1.0-1.i386.html suggests it's been around quite a while.
cat /etc/*release
It's universal for almost any major distribution.
[Belmiro#HP-550 ~]$ uname -a
Linux HP-550 2.6.30.10-105.2.23.fc11.x86_64 #1 SMP Thu Feb 11 07:06:34 UTC 2010
x86_64 x86_64 x86_64 GNU/Linux
[Belmiro#HP-550 ~]$ lsb_release -a
LSB Version: :core-3.1-amd64:core-3.1-noarch:core-3.2-amd64:core-3.2-noarch:deskt
op-3.1-amd64:desktop-3.1-noarch:desktop-3.2-amd64:desktop-3.2-noarch
Distributor ID: Fedora
Description: Fedora release 11 (Leonidas)
Release: 11
Codename: Leonidas
[Belmiro#HP-550 ~]$
These commands worked for Artik 10 :
cat /etc/fedora-release
cat /etc/issue
hostnamectl
and these others didn't :
lsb_release -a
uname -a
What about uname -a ?
On my installation of Fedora 25 (workstation) all of the distribution ID info was found in this file:
/usr/lib/os.release.d/os-release-workstation
This included,
NAME=Fedora
VERSION="25 (Workstation Edition)"
ID=fedora
VERSION_ID=25
PRETTY_NAME="Fedora 25 (Workstation Edition)"
<...>
VARIANT="Workstation Edition"
VARIANT_ID=workstation
You can simply run this command to get the version number:
rpm -E %fedora
output:
uname -a works with my fc11
use commmand , screenfetch
output format info.