Comandos Básicos do Linux

terça-feira, 2 de março de 2010
Alguns comandos básicos que você precisa saber para usar um Linux com facilidade..
comandos com exemplos abaixo




cd = Navega em pastas.
Código:
cd /usr/bin


pwd = Descubra em qual pasta está

Código:
pwd
/usr/bin


ls = Lista os arquivos dos diretórios

Código:
ls --all
.                         .gtk-recordmydesktop  .superkaramba
..                        .hplip                .thumbnails
.DCOPserver_localhost_:0  .hyperconf            .viminfo
.DCOPserver_localhost__0  .ies4linux            .windows-serial
.DownloadManager          .java                 .wine
.ICEauthority             .jmf                  .xine
.Mercury                  .kchmviewer           .xinitrc
.VirtualBox               .kde                  .xinitrc-backup
.Xauthority               .kderc                .xmms


uname = Saiba sobre o seu Kernel, Processador, hostname etc..

Código:
uname -a
Linux localhost 2.6.27.7-smp #2 SMP Thu Nov 20 22:32:43 CST 2008 i686 Intel(R) Celeron(R) CPU 3.06GHz GenuineIntel GNU/Linux


rm = Remove diretórios e arquivos

Código:
rm  sindicatohacker


mkdir = Crie diretórios

Código:
mkdir sh/forum


touch = Crie arquivos

Código:
touch sindicatohacker


vim = Edite ou Crie arquivos de texto

Código:
vim sindicatohacker


cat = Mostra o conteúdo de um certo arquivo

Código:
cat sindicatohacker
cowsay -f daemon "WWW.SINDICATOHACKER.ORG/FORUM"



chmod = Seta permissoes de usuário ou de execução.

Código:
chmod +x sindicatohacker


./ ou sh = Executa arquivos

Código:
./sindicatohacker
_______________________________
< WWW.SINDICATOHACKER.ORG/FORUM >
-------------------------------
   \         ,        ,
    \       /(        )`
     \      \ \___   / |
            /- _  `-/  '
           (/\/ \ \   /\
           / /   | `    \
           O O   ) /    |
           `-^--'`<     '
          (_.)  _  )   /
           `.___/`    /
             `-----' /
<----.     __ / __   \
<----|====O)))==) \) /====
<----'    `--' `.__,' \
             |        |
              \       /
        ______( (_  / \______
      ,'  ,-----'   |        \
      `--{__________)        \/

---

cp = Copia arquivos

Código:
cp sindicatohacker /dev/null


mv = Move, Substitui e Renomeia arquivos.

Código:
mv sindicatohacker /dev/null


halt = Desliga o sistema

Código:
halt OU shutdown -h OU init 0


reboot = Reinicia o sistema

Código:
reboot OU shutdown -r OU init 6


mount = Monta e desmonta dispositivos. etc...

Código:
mount /dev/sda1 /media/disk


umount = Desmonta dispositivos

Código:
umount /dev/sda1


eject = ejecta o cd ou dispositivos

Código:
eject /dev/cdrom OU PARA FECHAR A GAVETA DA LEITORA eject --trayclose


cfdisk = Particionador de dispositivos em modo texto

Código:
                         cfdisk (util-linux-ng 2.14.1)

                              Disk Drive: /dev/hda
                        Size: 40020664320 bytes, 40.0 GB
              Heads: 255   Sectors per Track: 63   Cylinders: 4865

    Name        Flags      Part Type  FS Type          [Label]        Size (MB)
------------------------------------------------------------------------------
    hda1                    Primary   Linux ReiserFS                   38996.06
    hda5                    Logical   Linux swap                        1019.94










     [ Bootable ]  [  Delete  ]  [   Help   ]  [ Maximize ]  [  Print   ]
     [   Quit   ]  [   Type   ]  [  Units   ]  [  Write   ]

                 Toggle bootable flag of the current partition


date = mostra a data

Código:
date
Mon Jul 13 23:24:20 BRT 2009


cal = mostra o calendario e o dia em que vc está.

Código:
cal
      July 2009   
Su Mo Tu We Th Fr Sa
          1  2  3  4
5  6  7  8  9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31


alsamixer = Mostra o volume do som no terminal

Código:
¦ Card: HDA Intel                                                              ¦
¦ Chip: Analog Devices AD1986A                                                 ¦
¦ View: [Playback] Capture  All                                                ¦
¦ Item: Master [dB gain=0.00]                                                  ¦
¦                                                                              ¦
¦    +--+     +--+      +--+    +--+     +--+      +--+     +--+     +--+     ¦
¦    ¦¦¦¦     ¦¦¦¦         ¦  ¦    ¦¦¦¦     ¦¦¦¦      ¦¦¦¦     ¦¦¦¦     ¦¦¦¦     ¦
¦    ¦¦¦¦     ¦¦¦¦      ¦¦¦¦     ¦¦¦¦     ¦¦¦¦      ¦¦¦¦     ¦¦¦¦     ¦¦¦¦     ¦
¦    ¦¦¦¦     ¦¦¦¦      ¦¦¦¦     ¦¦¦¦     ¦¦¦¦      ¦¦¦¦     ¦¦¦¦     ¦¦¦¦     >
¦    ¦¦¦¦     ¦¦¦¦      ¦¦¦¦     ¦¦¦¦     ¦¦¦¦      ¦¦¦¦     ¦¦¦¦     ¦¦¦¦     >
¦    ¦¦¦¦     ¦¦¦¦      ¦¦¦¦     ¦¦¦¦     ¦¦¦¦      ¦¦¦¦     ¦¦¦¦     ¦¦¦¦     >
¦    ¦¦¦¦     ¦¦¦¦      ¦¦¦¦     ¦¦¦¦     ¦¦¦¦      ¦¦¦¦     ¦¦¦¦     ¦¦¦¦     >
¦    ¦¦¦¦     ¦¦¦¦      ¦¦¦¦     ¦¦¦¦     ¦¦¦¦      ¦¦¦¦     ¦¦¦¦     ¦¦¦¦     >
¦    ¦¦¦¦     ¦¦¦¦      ¦¦¦¦     ¦¦¦¦     ¦¦¦¦      ¦¦¦¦     ¦¦¦¦     ¦¦¦¦     >
¦    ¦¦¦¦     ¦¦¦¦      ¦¦¦¦     ¦¦¦¦     ¦¦¦¦      ¦¦¦¦     ¦¦¦¦     ¦¦¦¦     ¦
¦    ¦¦¦¦     ¦¦¦¦      ¦¦¦¦     ¦¦¦¦     ¦¦¦¦      ¦¦¦¦     ¦¦¦¦     ¦¦¦¦     ¦
¦    ¦¦¦¦     ¦¦¦¦      ¦¦¦¦     ¦¦¦¦     ¦¦¦¦      ¦¦¦¦     ¦¦¦¦     ¦¦¦¦     ¦
¦    +--¦     +--¦      +--¦     +--¦     +--¦      +--¦     +--¦     +--¦     ¦
¦    ¦OO¦     ¦OO¦      ¦OO¦     ¦OO¦     ¦OO¦      ¦OO¦     ¦OO¦     ¦OO¦     ¦
¦    +--+     +--+      +--+     +--+     +--+      +--+     +--+     +--+     ¦
¦     100   100<>100   84<>84  100<>100 100<>100     100      100   100<>100   ¦
¦ < Master >Headphon    PCM     Front   Surround   Center    LFE      Line     ¦
+------------------------------------------------------------------------------+


netconfig = Entra no utilitario de configuração de rede

Imagem

whoami = Mostra qual usuário está logado

Código:
whoami
root


ifconfig = mostra e configura a internet

Código:
ifconfig
eth0      Link encap:Ethernet  HWaddr 00:17:31:77:9e:c0 
          inet addr:192.168.254.1  Bcast:192.168.254.255  Mask:255.255.255.0
          inet6 addr: fe80::217:31ff:fe77:9ec0/64 Scope:Link
          UP BROADCAST NOTRAILERS RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:460829 errors:0 dropped:0 overruns:0 frame:0
          TX packets:417137 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:546423045 (521.1 MiB)  TX bytes:141227570 (134.6 MiB)
          Interrupt:19

lo        Link encap:Local Loopback 
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:44 errors:0 dropped:0 overruns:0 frame:0
          TX packets:44 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:3168 (3.0 KiB)  TX bytes:3168 (3.0 KiB)


fsck = Escaneia o disco

Código:
fsck
fsck 1.41.3 (12-Oct-2008)
reiserfsck 3.6.20
Copyright (C) 2001-2005 by Hans Reiser, licensing governed by reiserfsprogs/COPYING.
*************************************************************
** If you are using the latest reiserfsprogs and  it fails **
** please  email bug reports to reiserfs-list@namesys.com, **
** providing  as  much  information  as  possible --  your **
** hardware,  kernel,  patches,  settings,  all reiserfsck **
** messages  (including version),  the reiserfsck logfile, **
** check  the  syslog file  for  any  related information. **
** If you would like advice on using this program, support **
** is available  for $25 at  www.namesys.com/support.html. **
*************************************************************

Will read-only check consistency of the filesystem on /dev/hda1
Will put log info to 'stdout'

Do you want to run this program?[N/Yes] (note need to type Yes if you do):


top = Mostra os processos rodando no computador

Código:
top - 23:35:57 up  9:57,  3 users,  load average: 0.05, 0.16, 0.16
Tasks: 104 total,   2 running, 102 sleeping,   0 stopped,   0 zombie
Cpu(s):  5.0%us,  0.7%sy,  0.0%ni, 94.3%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Mem:   1029468k total,   984008k used,    45460k free,    50808k buffers
Swap:   995988k total,      448k used,   995540k free,   439460k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND           
7663 root      20   0  399m 149m  30m S  6.0 14.8  91:21.02 firefox-bin       
2908 root      19  -1  301m  39m 9456 S  4.3  3.9  34:21.08 X                 
9734 root      20   0  719m 202m  17m S  2.7 20.1  11:15.25 java             
14960 root      20   0 71172  26m  10m R  2.0  2.6   0:04.18 Terminal         
15635 root      20   0  2344 1092  848 R  0.7  0.1   0:00.12 top               
2962 root      20   0 28872  13m   9m S  0.3  1.3   0:47.43 kwin             
11033 root      20   0  100m  14m 7144 S  0.3  1.5   0:26.48 artsd             
    1 root      20   0   772  296  260 S  0.0  0.0   0:02.62 init             
    2 root      15  -5     0    0    0 S  0.0  0.0   0:00.00 kthreadd         
    3 root      RT  -5     0    0    0 S  0.0  0.0   0:00.00 migration/0       
    4 root      15  -5     0    0    0 S  0.0  0.0   0:01.08 ksoftirqd/0       
    5 root      15  -5     0    0    0 S  0.0  0.0   0:01.14 events/0         
    6 root      15  -5     0    0    0 S  0.0  0.0   0:00.02 khelper           
  110 root      15  -5     0    0    0 S  0.0  0.0   0:01.58 kblockd/0


killall = Matra processos

Código:
killall firefox-bin


hostname = Mostra qual é o "nome" da maquina

Código:
hostname
localhost


chown = Modifica permissoes de pastas e arquivos

Código:
chown -hR alemao sindicatohacker~


su ( ou sudo su depende da distro ) = Pede permissoes maiores ( ou melhor dizendo: ROOT )

Código:
$ su
password:
Matrix ~ #

$ sudo su
password:
Matrix ~ #


clear = limpa a tela do terminal

Código:
clear


pkgtool = Gerencia pacotes do sistema ( esse comando nao serve para todos linuxies )

Imagem

UUUFFAAA....

Espero ter ajudado..


0 comentários:

Postar um comentário

Comente aqui!

 
Copyright © 2010 - Mk Downs