Alias – saját parancsok, sajátos névvel

 

A rendszeres Linux felhasználók nagyon gyorsan és hatékonyan tudnak „varázsolni” a parancssorral. Ez nem valami emberfeletti képesség, hanem sok gyakorlás és némi varázsszavak ismerete teszi lehetővé. Az egyik ilyen varázsszó az alias.

Mire is jó az alias?
Amikor hosszabb parancsokat használunk többször is, kezd bosszantóvá válni, hogy ugyanazt kel megismételni. Ilyenkor nagyon jó segítség számunkra az alias, ugyanis ezzel a megoldással saját egyedi parancsokat hozhatunk létre, vagy hosszú parancsokat rövidíthetünk meg. Egyik gyakori példa a ls –alF amit Ubuntu alatt az ll paranccsal kapunk.
Nézzük meg milyen alias-ok vannak már beállítva a rendszerünkbe.

alias

Paraméterek nélkül kilistázza a beállított alias-okat

Nálam ez a lista alapból így néz ki:

alias egrep='egrep --color=auto'

alias fgrep='fgrep --color=auto'

alias grep='grep --color=auto'

alias l='ls -CF'

alias la='ls -A'

alias ll='ls -alF'

alias ls='ls --color=auto'

 
Alias beállításához add ki a következő parancsot:

alias rövidnév=’a hosszú parancsodnak a paraméteresneve’

alias beállítás

alias nano=’nano –c –B’

Beállítottuk, hogy a nano szerkesztő sorszámozással és biztonsági mentéssel induljon.

Listázd ki az alias-okat és ott fogod látni az általad beírt sort is.
Próbáld ki. Hát nem csodálatos?!
Igen, de figyelem! Ahogy kiléptél a Shellből ez a sor eltűnik. :-(
 
Aggodalomra nincs ok! Most megmutatom, hogy tedd ezt véglegessé.
A rendszerben beállított, alias-ok a .bashrc fájlba vannak beégetve. Ebből a fájlból kettőt is találunk. Egy a /home/felhasználó könyvtárunkba és egy a /etc/ könyvtárba van. Ha megnézzük annak a fájlnak a tartalmát, ami a saját könyvtárunkba van, megtaláljuk az úgymond rendszerbe égetett alias-okat. Az új alias-okat akár elkezdheted ide is beírogatni. De ha figyelmesen átolvastad a fájlt, akkor látni fogod, hogy fel van készítve arra, hogy a saját alias gyűjteményedet beolvassa. Keresd meg a következő sorokat:

if [ -f ~/.bash_aliases ]; then

    . ~/.bash_aliases

fi

Ha nem találod a fenti sorokat, akkor írd be.
Most hozzuk létre a .bash_aliases fájlt

nano  ~/.bash_aliases

Írjunk is be egy pár rövidítést:

alias cls=’clear’

A Windowsból megszokott képernyőtörlés.

 
Ezek után lépjünk ki, majd megint lépjünk vissza és ellenőrizzük, hogy milyen szépen hallgat a Linux a varázsszavakra.
 

Hozzászólások

Thanks for finally talking about > Új hozzászólás | linux.valodi.info < Loved it!

My weblog Tallest building

Hey would you mind letting me know which webhost you're working with?

I've loaded your blog in 3 different browsers and I must say this blog

loads a lot quicker then most. Can you suggest a good hosting provider at a honest price?

Cheers, I appreciate it!

my webpage taller insole

I've been browsing online greater than three hours these days, yet I never discovered any fascinating article

like yours. It's lovely worth enough for me. In my opinion, if all website owners and

bloggers made just right content material as you probably did,

the internet might be a lot more helpful than ever before.

Feel free to visit my web blog ... PVC

Hi there it's me, I am also visiting this web page regularly,

this web site is actually fastidious and the users are really sharing pleasant thoughts.

my web blog - grow taller pills

I love it whenever people come together and share ideas.

Great blog, keep it up!

Review my weblog; taller than you ??

Undeniably believe that which you said. Your favorite justification seemed to be on the net the simplest thing to be

aware of. I say to you, I certainly get annoyed while people consider

worries that they plainly do not know about.

You managed to hit the nail upon the top as

well as defined out the whole thing without having side effect , people could take a signal.

Will likely be back to get more. Thanks

Feel free to surf to my weblog ... Tallebudgera Creek Dam

Does your website have a contact page? I'm having trouble locating

it but, I'd like to shoot you an email. I've got some ideas for your

blog you might be interested in hearing. Either way, great blog

and I look forward to seeing it expand over time.

Also visit my web-site shoe liftsa ?

Thanks for ones marvelous posting! I truly enjoyed reading it, you may

be a great author. I will make certain to bookmark your

blog and will often come back in the foreseeable future.

I want to encourage one to continue your great posts, have a nice holiday weekend!

Here is my web page: Apotek Online - http://bestenettapotek.life/ -

Do you have a spam problem on this site; I also am a blogger, and I

was wondering your situation; we have created some nice methods and we are looking

to swap strategies with other folks, please shoot me an e-mail if interested.

Check out my weblog - Tallarook

Hello every one, here every person is sharing these kinds of knowledge, therefore

it's good to read this web site, and I used to go younger 21 days to a foam roller physique see this weblog daily.

Hi there, I think your site could possibly be

having web browser compatibility issues. When I take a look

at your blog in Safari, it looks fine but when opening in IE,

it's got some overlapping issues. I just wanted

to give you a quick heads up! Aside from that, excellent

site!

My blog post: Tall Eryngo

Hi there! I could have sworn I've visited this

web site before but after browsing through many of the posts I realized it's

new to me. Regardless, I'm certainly delighted I found it and I'll be

bookmarking it and checking back often!

My web-site ... Talluru Thomas Gabriel

It's going to be finish of mine day, except before end I

am reading this fantastic piece of writing to increase my experience.

Also visit my website: online-apotheker.life

Hey there! This is my first comment here so I just wanted to give a quick shout out and say I really enjoy reading your

posts. Can you suggest any other blogs/websites/forums that cover the same

topics? Thank you!

Also visit my homepage: Idaho)

Greetings! I've been reading your website for a long time now and

finally got the bravery to go ahead and give you a shout out from Austin Tx!

Just wanted to tell you keep up the excellent work!

Here is my weblog al taller del maestro

Hello there, I found your site by the use of Google even as searching for a similar subject, your site came up, it

appears to be like great. I've bookmarked it in my google bookmarks.

Hi there, simply become aware of your weblog

via Google, and located shoes that make you taller it is truly informative.

I am going to be careful for brussels. I will be grateful in the event

you proceed this in future. Lots of other people might be benefited out of your writing.

Cheers!

Wow! In the end I got a weblog from where I can actually take valuable information concerning

my study and knowledge.

My webpage - Shoplifts

Hello, Neat post. There's a problem along with your website in web explorer, would

check this? IE still is the marketplace chief and a large component of other

folks will leave out your great writing due to this problem.

My web-site; {aby schudnąć

Oldalak

Új hozzászólás

Filtered HTML

  • A webcímek és email címek automatikusan kattintható hivatkozásokká alakulnak.
  • Engedélyezett HTML jelölők: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • A sorokat és bekezdéseket a rendszer automatikusan felismeri.

Plain text

  • A HTML jelölők használata nem megengedett.
  • A webcímek és email címek automatikusan kattintható hivatkozásokká alakulnak.
  • A sorokat és bekezdéseket a rendszer automatikusan felismeri.
Ezt a mezöt ember.fia nem.tölti ki.
CAPTCHA
Ez a művelet azért szükséges, mert nem szeretnék kéretlen bejegyzéseket az oldalra.
Kép CAPTCHA
Írd be a képen látható karaktereket. Köszönöm.