Linux

O Linux é um sistema operacional gratuito. Existem várias distribuições diferentes, como por exemplo:

  • Debian ( direcionada para uso em servidores)
  • Slackware ( Um pouco difícil de ser ser instalada e utilizada)
  • Suse
  • Ubuntu ( Distribuição fácil de ser utilizada e com bastante difundida, baseada em Debian)
  • Kurumin ( Linux brasileiro, muita documentação em português, baseada em Debian)

Aqui disponibilizarei alguns comandos básicos ou não utilizados no dia a dia, para usuários de primeira viajem.

Instalando Programas no Linux

Arquivos .deb

Para instalar pacotes deb, baixe o aquivo .deb e depois execute a seguinte instrução:
dpkg -i *.deb

Arquivos .rpm

Para instalar pacotes rpm, baixe o aquivo .rpm e depois execute a seguinte instrução:
rpm -i *.rpm

Ferramentas Gráficas no Linux

Acesso remoto

ssh fulano@host
ssh host -l login

ex.: ssh rb.nrfu.acd.tenlatan|seliuqa#rb.nrfu.acd.tenlatan|seliuqa
ex.: ssh natalnet.dca.ufrn.br -l aquiles

Transferir arquivos remotamente

scp -P 2222 ArquivoFonte usuário@host:diretório/ArquivoAlvo
scp -P 2222 usuário@host:diretório/ArquivoFonte ArquivoAlvo

Como procurar por programas no apt-get

Para mostrar os possíveis pacotes: apt-cache search NomeDoPrograma

Como instalar o Java 6 no UBuntu

sudo apt-get install sun-java6-jdk

Como instalar o JMF no Ubuntu 7.04 feisty

chmod a+x jmf-2_1_1e-linux-i586.bin
sudo mkdir /usr/share/JMF-2.1.1e
sudo cp jmf-2_1_1e-linux-i-586.bin /usr/share/JMF-2.1.1e
cd /usr/share/JMF-2.1.1e
sudo sh jmf-2_1_1e-linux-i586.bin

Executar JMStudio quando ele normalmente não executa

java -Dawt.toolkit=sun.awt.motif.MToolkit JMStudio

Como saber a versão do Ubuntu

lsb_release -a

Depois de instalado a nova versão do Java, como atualizar para usar a nova.

sudo update-java-alternatives -s java-6-sun

Como saber quanto ainda tenho de espaço livre em disco

df -h

Adicionar variáveis de ambiente

vi /etc/environment
. /etc/environment

Estrutura de Diretórios

/ - Root directory that forms the base of the file system. All files and directories are logically contained inside the root directory regardless of their physical locations.

/bin - Contains the executable programs that are part of the Linux operating system. Many Linux commands, such as cat, cp, ls, more, and tar, are locate in /bin

/boot - Contains the Linux kernel and other files needed by LILO and GRUB boot managers.

/dev - Contains all device files. Linux treats each device as a special file. All such files are located in /dev.

/etc - Contains most system configuration files and the initialisation scripts in /etc/rc.d subdirectory.

/home - Home directory is the parent to the home directories of users.

/lib - Contains library files, including loadable driver modules needed to boot the system.

/lost+found - Directory for lost files. Every disk partition has a lost+found directory.

/media - Directory for mounting files systems on removable media like CD-ROM drives, floppy disks, and Zip drives.

/mnt - A directory for temporarily mounted filesystems.

/opt - Optional software packages copy/install files here.

/proc - A special directory in a virtual filesystem. It contains the information about various aspects of a Linux system.

/root - Home directory of the root user.

/sbin - Contains administrative binary files. Commands such as mount, shutdown, umount, reside here.

/srv - Contains data for services (HTTP, FTP, etc.) offered by the system.

/sys - A special directory that contains information about the devices, as seen by the Linux kernel.

/tmp - Temporary directory which can be used as a scratch directory (storage for temporary files). The contents of this directory are cleared each time the system boots.

/usr - Contains subdirectories for many programs such as the X Window System.

/usr/bin - Contains executable files for many Linux commands. It is not part of the core Linux operating system.

/usr/include - Contains header files for C and C++ programming languages

/usr/lib - Contains libraries for C and C++ programming languages.

/usr/local - Contains local files. It has a similar directories as /usr contains.

/usr/sbin - Contains administrative commands.

/usr/share - Contains files that are shared, like, default configuration files, images, documentation, etc.

/usr/src - Contains the source code for the Linux kernel.

/var - Contains various system files such as log, mail directories, print spool, etc. which tend to change in numbers and size over time.

/var/cache - Storage area for cached data for applications.

/var/lib - Contains information relating to the current state of applications. Programs modify this when they run.

/var/lock - Contains lock files which are checked by applications so that a resource can be used by one application only.

/var/log - Contains log files for differenct applications.

/var/mail - Contains users’ emails.

/var/opt - Contains variable data for packages stored in /opt directory.

/var/run - Contains data describing the system since it was booted.

/var/spool - Contains data that is waiting for some kind of processing.

/var/tmp - Contains temporary files preserved between system reboots.

Instalando netbeans6 no kurumin

sudo kedit /etc/apt/sources.list &
Adicionar no source.list: deb http://srvremi.free.fr/ubuntu gutsy main

gpg —keyserver wwwkeys.eu.pgp.net —recv-keys AA82C25A36399439
gpg —armor —export AA82C25A36399439 | sudo apt-key add -
sudo apt-get update

Instalando o Java6 no Debian

1) Como root
2) Ediciona a seguinte linha:
deb http://ftp.debian.org/debian/ unstable main non-free
No arquivo /etc/apt/source.list
3) Dê um:
apt-get update
4) Depois:
sudo apt-get install sun-java6-jdk

Habilitando o som no laptop HP

edit /etc/modprobe.d/alsa-base
adicionar no final do arquivo:
options snd-hda-intel model=laptop
reboot

Acessar o ftp por linha de comando

aquiles@mossoro:~$ ftp www.natalnet.br
Connected to www.natalnet.br.
220 ProFTPD 1.3.0 Server (Debian) [187.111.225.221]
Name (www.natalnet.br:aquiles): usuario
331 Password required for usuario.
Password:
230 User usuario logged in.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> ls
200 PORT command successful
150 Opening ASCII mode data connection for file list
-rwxr-xr-x 1 root root 1165281280 Feb 12 13:21 Teste-Distro-2.iso
-rwxr-xr-x 1 root root 1013786624 Feb 12 13:49 Teste-Distro-3.iso
226 Transfer complete.
ftp> get Teste-Distro-3.iso
local: Teste-Distro-3.iso remote: Teste-Distro-3.iso
200 PORT command successful
150 Opening BINARY mode data connection for Teste-Distro-3.iso (1013786624 bytes)

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-Share Alike 2.5 License.