Utilizando alias para agilizar comandos no Linux
A sintaxe a ser seguida:
alias apelido=’comando’
Abaixo alguns casos que costumo utilizar.
Espaço em disco:
$ alias df=’df -h’
Listando arquivos e pastas:
$ alias ls=’ls -la’
Obs.: Nos dois exemplos acima eu não usei apelidos e sim atalhos, embutindo parâmetros mais utilizados nos seus respectivos comandos.
Para acessar um servidor via ssh:
$ alias acessossh=’ssh user@ipdoservidor’
Para atualizar as lista de repositórios:
$ alias atualizar=’sudo apt-get upgrade’
Para procurar pacotes via APT:
$ alias buscar=’apt-cache search’
Ex.:
$ buscar samba
Para instalar programas via “apt”:
$ alias instalar=’sudo apt-get install’
Ex.:
$ instalar samba
Para remover programas via “apt”:
$ alias remover=’sudo apt-get remove’
Ex.:
$ remover samba
How to find your Linux Kernel Version
Locating your Linux Kernel Version:
Open up a terminal and type one of the following commands listed in bold text.
uname -a (prints all information)
uname -r (prints the kernel release)
uname -v (prints the kernel version)
uname -o (prints the operating system)
Converting .rpm Packages To Debian/Ubuntu .deb Format With Alien
Alien Installation
Alien is available in the normal Debian repositories, so we can install it like this:
apt-get install alien
Converting .rpm To .deb
Next we download the current mysql-zrm rpm package (1.1-1 at the time of this writing):
cd /tmp
wget http://www.zmanda.com/downloads/community/ZRM-MySQL/1.1/Linux/MySQL-zrm-1.1-1.noarch.rpm
To convert it into a .deb package, we simply run
alien MySQL-zrm-1.1-1.noarch.rpm
Afterwards, run
ls -l
in the /tmp directory, and you’ll see that alien has created the file mysql-zrm_1.1-2_all.deb. You’ll also notice that alien has counted up the version number, it’s now 1.1-2 instead of 1.1-1. If you want to keep the original version number, you must use the -k switch:
alien -k MySQL-zrm-1.1-1.noarch.rpm
will create the file mysql-zrm_1.1-1_all.deb.
To install the new .deb file, we use dpkg -i:
dpkg -i mysql-zrm_1.1-1_all.deb
Now mysql-zrm is installed and fully functional (you still might have to edit its configuration file though).
If you want to save the dpkg -i step, you can have alien install the package. The command
alien -i MySQL-zrm-1.1-1.noarch.rpm
would convert the original rpm package and immediately install it.
You see, converting .rpm files to .deb files is very easy. You can have a look at
man alien
to learn about what else you can do with alien.
How do I list all USB devices?
lsusb – list USB devices
To make use of all the features of this program, you need to have a Linux kernel which supports the /proc/bus/usb interface (e.g., Linux kernel 2.3.15 or newer).
$ lsusb
Output:
Bus 004 Device 002: ID 0930:6532 Toshiba Corp. Bus 004 Device 001: ID 0000:0000 Bus 003 Device 001: ID 0000:0000 Bus 002 Device 001: ID 0000:0000 Bus 001 Device 001: ID 0000:0000
To get verbose output type the command:
$ lsusb -v
RootSudo
root account
Enabling the root account
sudo -i
To enable the root account (i.e. set a password) use:
sudo passwd rootRe-disabling your root account
sudo usermod -p '!' root