LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This 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


Reply
  Search this Thread
Old 07-25-2017, 10:18 PM   #1
expplane
LQ Newbie
 
Registered: Jul 2017
Posts: 2

Rep: Reputation: Disabled
Bourne Shell aliases


I am familiar with the Bash shell, however I have begun learning to program in Raspbian linux which is specifically for the Raspberry Pi micro computer.
I want to put some aliases in what is the .bashrc file in bash shell distros however the only file similar in the Bourne shell is the /etc/profile. There are no entries in this text file with the alias command and when I enter in my home directory the alias command it returns 'no such command'.
So how are aliases entered in a Bourne shell?
 
Old 07-26-2017, 01:12 AM   #2
aragorn2101
Member
 
Registered: Dec 2012
Location: Mauritius
Distribution: Slackware
Posts: 553

Rep: Reputation: 277Reputation: 277Reputation: 277
Hi and welcome to LQ,

You add aliases by specifying them in either the /etc/profile (for global system config, i.e. for all users) or in your local HOME/.bashrc (for your own environment config only). They are defined as in Bash, e.g.
Code:
alias l='/usr/bin/ls --color=auto -F'
alias ll='/usr/bin/ls --color=auto -l -h'
alias df='/usr/bin/df -h --output=source,fstype,itotal,ipcent,iused,iavail,size,pcent,used,avail,target'
But use aliases carefully. Try to avoid conflicts with existing commands or existing aliases. Use the alias command to see all aliases already defined in the environment.
 
1 members found this post helpful.
Old 07-26-2017, 09:44 AM   #3
RockDoctor
Senior Member
 
Registered: Nov 2003
Location: Minnesota, US
Distribution: Fedora, Ubuntu, Manjaro
Posts: 1,778

Rep: Reputation: 424Reputation: 424Reputation: 424Reputation: 424Reputation: 424
Not sure if Raspbian works like Ubuntu, but in Ubuntu 17.10 on my desktop, I've placed aliases for all users in /etc/bash.bashrc
Code:
cat /mnt/GU1710/etc/bash.bashrc | grep alias
alias ls="ls --color"
alias dir="ls -al"
alias md=mkdir
alias rd=rmdir
 
Old 07-26-2017, 10:25 AM   #4
expplane
LQ Newbie
 
Registered: Jul 2017
Posts: 2

Original Poster
Rep: Reputation: Disabled
Bourne shell aliases

Thanks for the reply; found the /home/.bashrc file and sure enough it has the alias commands. Put my favorite alias ll='ls -al | more' in and it works. As I remember the .bashrc file in a bash shell distro is in the root directory structure. It's been awhile .
 
Old 07-26-2017, 11:24 AM   #5
pan64
LQ Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 16,644

Rep: Reputation: 5615Reputation: 5615Reputation: 5615Reputation: 5615Reputation: 5615Reputation: 5615Reputation: 5615Reputation: 5615Reputation: 5615Reputation: 5615Reputation: 5615
in general Raspbian is a debian release for Raspberry Pi, and the bash is almost the same as on any other release.
By the way bash means Bourne-Again SHell.The original bourne shell is named sh, not bash. You can read about .bashrc and related files on the man page of bash.
 
Old 07-26-2017, 02:27 PM   #6
lazydog
Senior Member
 
Registered: Dec 2003
Location: The Key Stone State
Distribution: CentOS Sabayon and now Gentoo
Posts: 1,249
Blog Entries: 3

Rep: Reputation: 194Reputation: 194
Check my Blog I have a large list of aliases I use and how I call them.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
[SOLVED] Getting the Bourne again Shell drmjh Linux - General 16 07-03-2011 06:23 AM
xargs bourne shell bazzano Programming 5 04-16-2009 07:11 AM
'sh' shell - Actually calls legacy Bourne shell, or uses system default? Dtsazza Linux - Software 1 10-28-2005 09:20 AM
Bourne Again SHell help MagInnovision Linux - Newbie 2 02-04-2003 03:43 PM
Bourne shell programming noodle123 Programming 3 04-16-2002 03:46 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 03:15 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