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!
Notices
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 use a command on a semi regular basis thats a bind to type out. Is there a way of automating it? I'm not familiar with programming or scripting so any pointers would be great. I've currently saved it as a text file and paste it in when required, but to be able to just type a shortcut for it like ls or whatever would be great.
so you have it in a file, I'll call it "text". Wouldn't
./text
do it?
That is, typing ./text at the comand prompt. You could have the file in your user's directory under home, and then all you'd have to do is open a terminal and type ./text. Your file might resemble this:
cd Desktop/YourFolder/YourPathYouMightNeed
<Your stuff you do>
I don't know for sure if that works, and I bet it's not the best way either. I'm a newbie too, I'm just trying to give back.
robjob
You will want the first line of the script to indicate which shell you are using.
For example for bash:
#!/bin/bash
If your script takes a parameter, use '$1' as the parameter.
Then after you save the script, you need to make it executable with the command:
chmod u+x <filename>
You could also create a directory called 'bin' in your home directory and add the path in your ~/.bash_profile file. This file is executed when you log-in.
That is what I did with mine:
Code:
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
PATH=$PATH:$HOME/bin
export PATH
unset USERNAME
sounds like perhaps you're not using a bash shell. I am a total newbie, so I am not familiar with any other shells. Nor am I familiar with Suse.
Do you have any idea what kind of shell you're using?
If I understand correctly, the alias worked at some point. Could you detail what you did when you created the alias, what you did right after creating it that made it work, and finally what you did between the time it worked and when it stopped working.
i'm sure i'm using bash. it just seems that the alias only works until i close the terminal. when i try again bash reports that the command is not found. there must be a file somewhere that needs altering but i don't know which one.
A) there's the bash history ...
Ctrl-R and starting to type a part of the command will
bring it back.
B) You can put the alias definition in ~/.bashrc
or ~/bash_profile (whichever is appropriate on
your machine)
The ~/.bash_profile command is executed when you first log on. ~/.bashrc is executed when starting an interactive shell. You probably want to add the alias definition in ~/.bash_profile so that it is available as soon as you log on.
If you want the alias defined for all users. Then add the alias definition to /etc/profile.d/bash.sh.
well you can do 1 of 2 things ... or both i guess ...
we'll pretend your using vim as your text editor so if you type :
vim .bashrc
and then you save that file, then it will be there ...
or you can simply type from a prompt :
touch .bashrc
and it will be there, obviously with nothing in it ...
and then you would have to open it and add whatever it is you want ..
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.