LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 11-06-2004, 09:58 AM   #1
SizofreNICK
LQ Newbie
 
Registered: Nov 2004
Posts: 4

Rep: Reputation: 0
Question adding my own commands to rc files


Hi every one!

I want to add my own commands such as alias "c=clear". I want to make this shortcut remain after restart! Where should I add this command? (I am using slackware 10 with dropline gnome)

Thank you so much!
 
Old 11-06-2004, 10:12 AM   #2
mdarby
Member
 
Registered: Nov 2004
Location: Columbus, Ohio
Distribution: Slackware-Current / Debian
Posts: 795

Rep: Reputation: 30
In your home directory, create .bash_profile if it doesn't exist. Ensure that the .bash_profile has:

if [ -f ~/.bashrc ]; then
source ~/.bashrc
fi

inside of it.

Create .bashrc in your home directory, and list any aliases you'd like.
I've attached my .bashrc for examples. (note: make sure to logoff/login to reload the .bashrc file.)

=======================================================

ulimit -m 500000
ulimit -v 500000

export VISUAL=pico
export EDITOR=pico

PS1="\u@\h:\w\$ "

alias ..='cd ..'
alias laser='lpr -P Laser'
alias c='clear'
alias l='ls -l'
alias la='ls -Al'
alias ls='ls -hF --color'
alias lx='ls -lXB'
alias lk='ls -lSr'
alias lc='ls -lcr'
alias lu='ls -lur'
alias lr='ls -lR'
alias lt='ls -ltr'
alias lm='ls -al | more'
alias print_pdf='lpr -P Print_PDF'
alias mkdir='mkdir -p'
alias pg='ps aux | grep'
alias q='postqueue -p'
alias r_bash='~/.bashrc'
alias r_apache='apachectl stop && apachectl startssl'
alias r_postfix='postfix reload'
alias work='ssh -l mdarby proxy.dynamix-ltd.com'
alias t='clear && tail -f'
alias tree='tree -su'

RED='\e[1;31m'
BLUE='\e[1;34m'
CYAN='\e[1;36m'
NC='\e[0m'

function ii(){
clear
echo -e "\nYou are logged on ${RED}$HOSTNAME"
echo -e "\nAdditionnal information:$NC " ; uname -a
echo -e "\n${RED}Users logged on:$NC " ; w -h
echo -e "\n${RED}Current date :$NC " ; date
echo -e "\n${RED}Machine stats :$NC " ; uptime
echo -e "\n${RED}Memory stats :$NC " ; free -m
echo -e "\n${RED}Disk usage :$NC " ; df -lh
echo -e "\n${RED}Local IP Address :$NC" ; /sbin/ifconfig eth0 | awk '/inet/ { print $2 } ' | sed -e s/addr://
echo -e "----------------------------------------------------------------------\n"
}

function ff(){ find $1 -type f -iname '*'$2*'*' -ls ; }

function fe(){ find $1 -type f -iname '*'$2'*' -exec "${3:-file}" {} \; ; }

===============================================

Last edited by mdarby; 11-06-2004 at 10:13 AM.
 
Old 11-06-2004, 10:13 AM   #3
65_289
Member
 
Registered: May 2002
Distribution: Ubuntu 5.04, Kanotix
Posts: 163

Rep: Reputation: 30
I believe it should go in the .bashrc file.

[edit] D'oh! Beaten to it!
 
Old 11-06-2004, 10:18 AM   #4
SizofreNICK
LQ Newbie
 
Registered: Nov 2004
Posts: 4

Original Poster
Rep: Reputation: 0
First I want to thank you for your reply!

Second. I usually logged with root. Because I can't reach my files which are in my NTFS partitions, if I logged in any user.

Where should I put the .bashrc when I logged as root?

Thank you again!
 
Old 11-06-2004, 10:18 AM   #5
mdarby
Member
 
Registered: Nov 2004
Location: Columbus, Ohio
Distribution: Slackware-Current / Debian
Posts: 795

Rep: Reputation: 30
When logged in as root, simply put .bashrc into /root. (/root/.bashrc)
 
Old 11-06-2004, 10:20 AM   #6
SizofreNICK
LQ Newbie
 
Registered: Nov 2004
Posts: 4

Original Poster
Rep: Reputation: 0
Oh you are goergous! Thank you so much!
 
Old 11-06-2004, 10:21 AM   #7
mdarby
Member
 
Registered: Nov 2004
Location: Columbus, Ohio
Distribution: Slackware-Current / Debian
Posts: 795

Rep: Reputation: 30
Not a problem! Glad I could help
 
Old 11-06-2004, 02:16 PM   #8
65_289
Member
 
Registered: May 2002
Distribution: Ubuntu 5.04, Kanotix
Posts: 163

Rep: Reputation: 30
Quote:
Originally posted by SizofreNICK
First I want to thank you for your reply!

Second. I usually logged with root. Because I can't reach my files which are in my NTFS partitions, if I logged in any user.

Where should I put the .bashrc when I logged as root?

Thank you again!
Logging is as root is a terrible idea, IMHO. All services and programs are ran as root, which means any exploit will have root privledges. Also, you could potentially delete necessary system files as root.

If I were you, I'd go edit my /etc/fstab and make it readable by anybody, assuming you only have 1 other user. Mine looks like this:

/dev/hda2 /mnt/windows ntfs umask=0222,noauto,ro,users

That gives everyone in the system read and execute (but not write) permissions for the drive.

Last edited by 65_289; 11-06-2004 at 02:19 PM.
 
Old 11-07-2004, 02:30 AM   #9
SizofreNICK
LQ Newbie
 
Registered: Nov 2004
Posts: 4

Original Poster
Rep: Reputation: 0
Oh this is a very precious information! Thanx. I will try to do this! Thank you again!
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding Boot Commands pjpeter Linux - Newbie 6 01-25-2005 08:10 PM
adding commands to /bin (root user) xone Linux - Software 4 03-23-2004 12:26 PM
adding commands? megaman Linux - Newbie 2 12-20-2003 03:57 PM
Using commands to output to files, how is this done? nro Linux - Newbie 3 11-11-2003 08:38 PM
Adding xgamma commands to startup on RH8 HellBound Linux - Software 2 03-12-2003 08:52 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 06:43 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration