LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 05-23-2016, 02:32 PM   #16
descendant_command
Senior Member
 
Registered: Mar 2012
Posts: 1,426

Rep: Reputation: 370Reputation: 370Reputation: 370Reputation: 370

Well 'dir' IS an actual linux binary (part of GNU coreutils according to 'man dir').

Code:
$ ls -l $(which dir)
-rwxr-xr-x 1 root root 118280 Mar 15  2015 /bin/dir
Your aliases only last as long as your user session - you put them in your .bashrc or such to be set when you login.

Last edited by descendant_command; 05-23-2016 at 02:35 PM.
 
Old 05-23-2016, 02:34 PM   #17
Krisburns
LQ Newbie
 
Registered: May 2016
Posts: 2

Rep: Reputation: Disabled
Quote:
Originally Posted by monahanz View Post
They seemed to work fine. However what I cannot understand is when I reboot the system they are no longer recognized – yet the original dir alias works. I tried doing the above two alias’es in the top directory by using cd / still no luck.
Help please
John
If you want your aliases to work after a reboot, you'll have to add them to /etc/bashrc.


If the aliases are for a specific user only, you can add them to your home's .bashrc file. It's a hidden file in yor home directory.
 
Old 05-23-2016, 02:34 PM   #18
273
LQ Addict
 
Registered: Dec 2011
Location: UK
Distribution: Debian Sid AMD64, Raspbian Wheezy, various VMs
Posts: 6,396

Rep: Reputation: 1759Reputation: 1759Reputation: 1759Reputation: 1759Reputation: 1759Reputation: 1759Reputation: 1759Reputation: 1759Reputation: 1759Reputation: 1759Reputation: 1759
Quote:
Originally Posted by descendant_command View Post
Well 'dir' IS an actual linux binary.

Code:
$ ls -l $(which dir)
-rwxr-xr-x 1 root root 118280 Mar 15  2015 /bin/dir
Your aliases only last as long as your user session - you put them in your .bashrc or such to be set when you login.
Good catch, I did run dir on this machine before posting and it worked but forgot to mention its presence.
 
Old 05-23-2016, 02:53 PM   #19
af7567
Member
 
Registered: Nov 2012
Posts: 182

Rep: Reputation: 58
Quote:
Originally Posted by monahanz View Post
They seemed to work fine. However what I cannot understand is when I reboot the system they are no longer recognized – yet the original dir alias works. I tried doing the above two alias’es in the top directory by using cd / still no luck.
To have it remember the aliases for every session you need to put them into your .bashrc or .profile. You must have done that with the dir alias but not the others.
 
Old 05-23-2016, 03:00 PM   #20
Emerson
LQ Guru
 
Registered: Nov 2004
Location: Saint Amant, Acadiana
Distribution: Gentoo ~arch
Posts: 5,882

Rep: Reputation: Disabled
As an alternative you can create symlinks.
 
Old 05-23-2016, 03:05 PM   #21
descendant_command
Senior Member
 
Registered: Mar 2012
Posts: 1,426

Rep: Reputation: 370Reputation: 370Reputation: 370Reputation: 370
Although symlinks won't include your desired switches.
 
Old 05-23-2016, 03:56 PM   #22
monahanz
LQ Newbie
 
Registered: May 2016
Posts: 6

Original Poster
Rep: Reputation: Disabled
Two problems with the above.
1. The Edison/Linux does not appear to have a folder /etc/bashrc. It has a "/etc/bash_completion.d" folder/
2. How do you actually "put" the alias in the folder /etc/bashrc.

Should I create a folder /etc/bashrc
I tried going to the "/etc/bash_completion.d" folder and typing "alias stat='dd -H' . Worked but on reboot did not.

These are the types of issues newbies typically run into, I'm sure. I wish hard core users would not assume the above is obvious.
 
Old 05-23-2016, 04:14 PM   #23
timl
Member
 
Registered: Jan 2009
Location: Sydney, Australia
Distribution: Fedora,CentOS
Posts: 608

Rep: Reputation: 129Reputation: 129
read post #17 again in your home folder there is a hidden file .bashrc

Quote:
[tim@riverside ~]$ ls -a .bash*
.bash_history .bash_logout .bash_profile .bashrc
Insert your alias commands into .bashrc. I am not familiar with Edison linux but I am assuming the same rules hold true.

You need the "-a" switch on "ls" to see hidden files.
 
Old 05-23-2016, 05:18 PM   #24
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,396

Rep: Reputation: 2017Reputation: 2017Reputation: 2017Reputation: 2017Reputation: 2017Reputation: 2017Reputation: 2017Reputation: 2017Reputation: 2017Reputation: 2017Reputation: 2017
Quote:
Originally Posted by monahanz View Post
Apparently in Linux you have to have a space before the '-' options!
For the first one, yes, but not between the rest unless the option has an argument that goes with it. For your example you could shorten it to simply:
Code:
ls -ABFgh
 
  


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
Why I keep getting "Cannot run program "dir": error=13, Permissions denied" Maryam_Persian Other *NIX 2 05-20-2013 03:01 PM
exclude parameter of rsync- 'dir' vs "dir" vs dir rng Linux - General 5 06-13-2012 01:47 AM
What's the difference between "mv dir/* /tmp" and "find dir/* -print0 | xargs" ? thomas2004ch Linux - Software 8 04-19-2012 10:43 AM
How can I get the "current work dir" using C function? wuzhong Programming 5 09-16-2004 06:47 AM


All times are GMT -5. The time now is 08:24 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration