Fórum:
Sziasztok!
Az alábbi probléma merült fel nálam. Létrehoztam pár egyszerübb alias bejegyzést, hogy megkönnyítsem a terminálos beírásokat, de valamiér nem találja meg a rendszer az összes alias-t. Mi lehet a hiba?
# Saját parancsok listája
alias fel='apt-get install -y -f'
alias teszt='apt-get install -s'
alias le='apt-get purge --autoremove'
alias frissit='apt-get update && apt-get dist-upgrade && apt-get autoclean'
alias keres='apt-cache search'
alias ir='xed'
alias win='wine'
alias re_php='systemctl restart apache2'
Lefut a keres.
apa@apa-System:~$ keres firefox
firefox - Safe and easy web browser from Mozilla
firefox-dbg - Safe and easy web browser from Mozilla - debug symbols
firefox-dev - Safe and easy web browser from Mozilla - development files
firefox-locale-af - Afrikaans language pack for Firefox
firefox-locale-an - Aragonese language pack for Firefox
firefox-locale-ar - Arabic language pack for Firefox
firefox-locale-ast - Asturian language pack for Firefox
firefox-locale-az - Azerbaijani language pack for Firefox
lefut: az ir
apa@apa-System:~/Asztal$ ir Linux_parancsok.txt
megnyitja xed-del az asztalon lévő file-t
Nincs parancs:
le, fel, frissit, teszt
________________________________________
Válaszokat előre is köszönöm.

alias
Beküldte atime -
Értékelés:
A frissit használatánál ha nincs frissitendő, a promptot adja vissza. A többinél hogy adod ki a parancsot, pl. fel firefox?
alias
Beküldte SunFighter -
Értékelés:
igen. pl:
apa@apa-System:~/Asztal$ sudo fel firefox
[sudo] apa jelszava:
sudo: fel: parancs nem található
sudo nélkül természetesen kiírja, hogy nem vagyok root joggal.
a re_php is gyönyörüen lefut, az apache2 -re bekéri ablakban a jogosultságom, utána újra indítja, ezért nem értem, hogy az egyik lefut, akkor a másik miért nem :)
.baschrc
Beküldte kimarite -
Értékelés:
A .baschrc fájlban egy lehetséges megoldás:
# Alias definitions. # You may want to put all your additions into a separate file like # ~/.bash_aliases, instead of adding them here directly. # See /usr/share/doc/bash-doc/examples in the bash-doc package. if [ -f ~/.bash_aliases ]; then . ~/.bash_aliases fiHa az aliasok a .bash_aliases fájlban vannak elmentve.
-----
A .profile fájl tartalma:
# ~/.profile: executed by the command interpreter for login shells. # This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login # exists. # see /usr/share/doc/bash/examples/startup-files for examples. # the files are located in the bash-doc package. # the default umask is set in /etc/profile; for setting the umask # for ssh logins, install and configure the libpam-umask package. #umask 022 # if running bash if [ -n "$BASH_VERSION" ]; then # include .bashrc if it exists if [ -f "$HOME/.bashrc" ]; then . "$HOME/.bashrc" fi fi # set PATH so it includes user's private bin if it exists if [ -d "$HOME/bin" ] ; then PATH="$HOME/bin:$PATH" fi # set PATH so it includes user's private bin if it exists if [ -d "$HOME/.local/bin" ] ; then PATH="$HOME/.local/bin:$PATH" fialias
Beküldte kimarite -
Értékelés:
A „fel” alias a telepítés. Nincs telepítve a Firefox már?
apt-get install -y -f firefox-esr -s NE FELEDJE: Ez csak szimuláció! Az apt-get rendszergazdai jogokat igényel a tényleges végrehajtáshoz. Ne feledje, hogy a zárolás is ki van kapcsolva, így ne számítson a jelenlegi helyzet valósságára! Csomaglisták olvasása... Kész Függőségi fa építése Állapotinformációk olvasása... Kész firefox-esr már a legújabb verzió (60.8.0esr-1~deb10u1). firefox-esr kézi telepítésűre állítva. 0 frissített, 0 újonnan telepített, 0 eltávolítandó és 0 nem frissített.Csinálhatnád így:
alias fel='sudo apt-get install'
alias teszt='sudo apt-get install -s'
alias le='sudo apt-get purge'
alias frissit='sudo apt-get update && sudo apt-get dist-upgrade && sudo apt-get clean'
De ez a megoldás:
Add the following line to your ~/.bashrc:
From the bash manual:
(Emphasis mine).
Bash only checks the first word of a command for an alias, any words after that are not checked. That means in a command like sudo ll, only the first word (sudo) is checked by bash for an alias, ll is ignored. We can tell bash to check the next word after the alias (i.e sudo) by adding a space to the end of the alias value.
Forrás: https://askubuntu.com/questions/22037/aliases-not-available-when-using-sudo
alias
Beküldte SunFighter -
Értékelés:
Végül is, alap hiba :) Talán a home könyvtáramba kellett volna megirnom :)
Köszönöm a segítséget ;)
alias
Beküldte kimarite -
Értékelés:
Az eredmény a lényeg, hogy sikerült. :-)