Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
I have 2 small problems, i have the sw11.0.
The 1st one, i want that my root directory be in the PATH, i add it, but i cant execute my C executable files directly.
I added the following directories into the PATH, /~, /root. It is wrong?
The 2nd is a vim remaping problem, i want to remap the f1 key to work like esc, i cant do it,i can remap esc to work calling help, but my f1 key dont work like esc. (i have the esc key a little far away and it force my hand to move out of the writing keys).
well your root directory should *NOT* be in your path. it's a really bad idea. if you wish to run your own compiled software, then you should put it in somewhere like /usr/local/bin/, or just run it with a relative or absolute path. now if you deicide to go against stnadard conventions then "/~" doesn't really make sense, it's invalid, but /root should be fine, so you've presumably got a syntax problem in the way you are defining it, or you are applying incorrectly somehow.
I do it, but it dosnt work. The .bashrc file was empty, and i dont know if it already exist before i open it with: vim .bashrc
I put the ls command, and i cant see the file. Why i cant see it?, it is ocult?.
a file that starts with a . is hidden. add the -a flag in ls and you'll see them. your bashrc really will always exist, unless you don't use bash or have a distro i've never seen before. you can also try ~/.profile too, which is largely shell agnostic.
It is common to have a ~/bin/ personal bin directory to execute your own scripts and personal program files. Commands you install from a tarball probably should be installed in /usr/bin/ or /usr/local/bin/.
You can add the line "export PATH=$PATH:$HOME/bin" to your ~/.profile file. The .profile is run when you login, so you will need to run it manually "./.profile" if you haven't logged out. Also, the ~/.bashrc file is run every time a new subshell is run, so if you used ~/.bashrc instead, your added paths will be added twice.
This is what comes when you install debian, it looks very similar:
root@debian# more /etc/profile
# /etc/profile: system-wide .profile file for the Bourne shell (sh(1))
# and Bourne compatible shells (bash(1), ksh(1), ash(1), ...).
if [ "`id -u`" -eq 0 ]; then
if [ "$PS1" ]; then
if [ "$BASH" ]; then
if [ "`id -u`" -eq 0 ]; then
yes, it calls ~/.bash_profile which as a standard for years and years has sourced ~/.bashrc if it's found. not sure why it really goes round the houses like that, but it's the way i've always known it.
Not that I would recommend this, but to map your F1 key in vi to be Esc you'll need to edit a file called .exrc in your home directory. Once in there enter the following.
:map! #1 ^[
Note: the ^[ is made using the keys Cntl+V Esc. To be more clear you hold down the control key and V at the same time, let go, then hit the Esc key. Using the map with ! means it will work while in insert mode, #1 is F1, and ^[ is how it interprets the escape key.
You may still encounter a problem if you are using a terminal window in Gnome(I don't have KDE, so don't know). The Gnome terminal will capture your F1 and bring up help before it gets to vi. This can be overridden. On the Terminal screen menu go to Edit, then Keyboard Shortcuts. At the bottom of the list you'll see F1 listed as the shortcut key for help.
Now, having said all that, it is not a good practice to use F1. F1 has been the standard help key on applications since function keys were first invented.
For the $PATH question I would not put an entry in /etc/profile since that is system wide. It would be better to put it in /root/.bash_profile. That is always executed during login and typically where your environment is set. Also since SW-ANIKY is talking C executables and not java, /root/bin would be a more appropriate directory. A few people have said something similar to this already, but here is the entry I would use.
While most distributions include 'if' logic to execute .bashrc in their .bash_profile, it is possible that is missing in SW-ANIKY's .bash_profile and that is why it's not working. A more probable explanation is that he did not logout and log back in or execute the .bashrc using the command source ~/.bashrc.
Some may disagree with me, but it is common practice to use .bashrc more for entering aliases and functions. I would put anything to do with the environment in .bash_profile.