Here's a simple linux command the give you the full path of of linux binary or executable command.
Which definition:
~~~~~~~~~~~~~~~~~~
Which Linux command shows the full path of any binary or shell command when executed. Which does the full patch searching by looking from the linux environment PATH variable. Which command can take one or more argument for processing. This 'which' linux comamnd follows the command line format as shown below:
which command1 command2
To list out your PATH environment variable from command line
# echo $PATH
Alternatively, you can grep PATH variable from your current environment shell like so
# set | grep PATH
Which Usage
~~~~~~~~~~~
Let us assume that you have a command named fixit that was installed from tar ball (tar.gz) and from rpm package (rpm). On which, fixit was probably installed into /usr/bin and /usr/local/bin .
To execute the command, simply issue
# fixit
The problem with this command is you don't know which binary has been executed by the system.
One way of resolving this issue is using which linux command by doing so
# which fixit
which then tells you which binary would be executed if fixit was issued from ther terminal. Which linux command also tells your the full path location of the command argument.
Final Which Note:
~~~~~~~~~~~~~~~~~
Using which, you can then know where would be the binary path location is when a command or executable shell would be executed. Which linux command is installed in Fedora by default system tools installation.
More which command line examples:
~~~~~~~~~~~~~~~~~~~~
# cd /home/me
# chmod 700 fixme
# which ./fixme
~~~~~~~~~~~~~~
/home/me/fixme
~~~~~~~~~~~~~~
# which which
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
alias which='alias | /usr/bin/which --tty-only --read-alias --show-dot --show-tilde'
/usr/bin/which
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# cd /tmp
# touch cat
# chmod 700 cat
# which ./cat
~~~~~~~~~~~~~~~~~~
/bin/cat
~~~~~~~~~~~~~~~~~~
# which echo dir
~~~~~~~~~~~~~~~~~~~~~~~~~~~
/bin/echo
/usr/bin/dir
~~~~~~~~~~~~~~~~~~~~~~~~~~~
HTH
Categories
- HowTos (608)
- Linux Devices (39)
- Linux Diggs (620)
- Linux News (1541)
- Linux Videos (21)
Recent Posts
- Linus Torvalds on Linux Distributions
- AMD to Spin off Manufacturing Operations
- MySQL cofounder David Axmark leaving Sun
- Mono to contribute back to CLI; Microsoft says it would adopt in .NET
- Monitor your network with GroundWork Monitor Community Edition
Blog Archive
-
▼
2008
(2301)
-
▼
October
(140)
- Linus Torvalds on Linux Distributions
- AMD to Spin off Manufacturing Operations
- MySQL cofounder David Axmark leaving Sun
- Mono to contribute back to CLI; Microsoft says it ...
- Monitor your network with GroundWork Monitor Commu...
- The LXF Guide: Write a Perl module
- 8 Best First-person Shooter Games for Linux
- AppDeploy Community Launches Free Windows Installe...
- Ubuntu Tweak - Sneak Peak at Latest Version!
- POS stack targets Linux netbooks
- RIP LinuxWorld
- Firefox extension blocks dangerous Web attack
- Wikia co-founder to speak at linux.conf.au
- Wikia co-founder to speak at linux.conf.au
- Look Ma, No ‘X’
- Look Ma, No ‘X’
- Forget the damn Linux netbooks. Can Windows replac...
- Forget the damn Linux netbooks. Can Windows replac...
- Amarok 2.0 Beta 2 was released
- 6 Years As A Professional Software Developer
- Amarok 2.0 Beta 2 was released
- 6 Years As A Professional Software Developer
- Distribution Release: EnGarde Secure Linux 3.0.21
- Torvalds talks about his brand new blog
- Become a multimedia pro with the Vector Linux Mult...
- Linux Robot - Watch This Space
- Distribution Release: EnGarde Secure Linux 3.0.21
- Torvalds talks about his brand new blog
- Become a multimedia pro with the Vector Linux Mult...
- Linux Robot - Watch This Space
- Linux-Based E-Voting In Brazil
- Is .NET on Linux Finally Ready?
- Linux-Based E-Voting In Brazil
- Multi-core networking stack ported to PowerPC
- Google rev's photo editor for Linux
- Project releases version 2.0 of open source .Net
- One more 2.6.27 prepatch
- Stallman vs. Clouds
- How to Create and Use a Password Reset Disk in Win...
- OpenOffice.org Grows Up
- 45+ Sources and Sets of Photoshop Custom Shapes
- Clean up your filesystems with fslint
- NPX-9000 UMPC is inexpensive but underpowered
- Will Chrome Find a Home With SaaS?
- Setting Up Your New Computer - Beginner User
- Distribution Release: ALT Linux 4.1 "Desktop&...
- Ubuntu, Fedora, OpenSUSE beta-fest
- Ubuntu, Fedora, OpenSUSE beta-fest
- Italian carrier ships Linux MID
- IT Business Edge: What Will Economy Do to Open Sou...
- Open-source resource for government launches onlin...
- Mono Moonlight – Shedding Light Without Gener...
- Linux Turns 17 Today
- Luc Verhaegen: Updated hackergotchi.
- Performance Comparison between NIO Frameworks
- First look: Latest Fedora and Ubuntu Betas Really ...
- Areca and plan/b offer Java-based backup for Linux...
- Cloud Computing: Perilous Pitfall or Panacea?
- BIOS Settings Demystified
- Mono 2 Released
- The Current State of the Economy and Linux
- DistroWatch Weekly, Issue 273
- Netbook Return Rates Much Higher For Linux Than Wi...
- KDE 4.1.2 Released
- A Disturbing Trend
- Tux Geek: Fix Your Music Library: Song Names, Albu...
- Updates On Older Posts
- Our second Linux laptop has a real keyboard
- Telepathy support in Qt Extended - soon in main Qt...
- Why Google App Engine is broken and what Google mu...
- Rethinking Window Management
- Software patenting will harm industry, consumer
- Download the Eee version of Ubuntu!
- Mozilla CEO John Lilly: World Domination Is Overra...
- Encoding Regular Emails Into SPAM - Net Humor
- e1000e Bug Squashed — Linux Kernel Patch Rel...
- MontaVista "Summit" concludes
- Open-source image editing project launches
- Convirt 0.9.5 released
- 5 GIMP Tricks Everyone Should Know!
- Playing with ASCII Values in ActionScript 3
- Centralized Backup Server With Amanda On CentOS
- Ubuntu on the beach
- Pidgin instant messaging client: a video tour
- Lindependence: A Low-Key Revolution in Software
- Pidgin Answering Machine - Splert Updated
- Distribution Release: VectorLinux 5.9 "Live&q...
- Apple Denigrates Psystar's Antitrust Claims
- Secure Your Gmail Account With SSL Encryption With...
- In Gimp We Trust
- Integrating APC (Alternative PHP Cache) Into PHP5 ...
- Six Reasons Why Linux Is Right for Small Business
- How Kernel Hackers Boosted the Speed of Desktop Li...
- Red Hat undercuts Microsoft on high-performance OS...
- Five programs you can afford in a financial meltdo...
- Gimp 2.6 out, GEGL still unfinished
- Ubuntu 8.10 Beta released
- Bash Parameter Expansion
- MontaVista Linux drives Dell's quick-boot feature
- Financial crisis may bode well for Linux
- pChart - Powerful Open Source Charting Library
- Ballmer: Microsoft Is Up-Front About Its Money Mot...
- GParted Live 0.3.9-4 Released
- A New Way of Sleeping in the Linux Kernel
- Freedom, software and society
- Development Release: Momonga Linux 5 RC
- Ubuntu Intrepid Ibex hits Beta
- Protect your network with pfSense firewall/router
- Survey: Open source benefits 'outweigh' problems
- In Gimp We Trust
- Reducing Boot Time On a General Linux Distro
- Virtualization design targets wireless base statio...
- Reducing Boot Time On a General Linux Distro
- 451 Group: Open source conference evolution, resta...
- Distribution Release: GParted LiveCD 0.3.9-4
- GIMP 2.6 released
- Free version of Hyper-V now available
- Linux - Is It For You?
- The Usability Problems of useit.com
- GIMP 2.6.0 Released
- Geek Reviews: Monitor And Benchmark Your PC With P...
- Android: Mobile Industry at a Crossroads
- Fedora 9 + Compiz-fusion with Nvidia Beta driver
- Sbopkg provides seamless package repository integr...
- Linux Foundation launches end-user conference
- The State of Bluetooth Headsets
- GNU IceCat 3.0.3 now available
- Open Source Software a Booster Shot for Health Car...
- Fast set up of an Erlang server for your web appli...
- Qt Extended 4.4 released, looks pretty
- The A-Z of Programming Languages: C#
- GNU Toolchain Update: September 2008
- National Free Software Conference, 2008
- Distribution Release: NetSecL 2.3
- So how do you REALLY feel about DRM?
- Nathive: A Free Linux Image Editor
- The Linux Safety Net: Living Fast and Dangerous
- Do we need a LinuxCon?
- New GNOME 2.24 Is An Incremental Improvement
- Microsoft Begins to Reveal Visual Studio 2010
-
▼
October
(140)
Thursday, September 20, 2007
Witchy which linux command
Subscribe to:
Post Comments (Atom)
ILoveTux - howtos and news | About | Contact | TOS | Policy


0 comments:
Post a Comment