Comandos mais usados no ShellScript

.

Comandos mais usados em Shell Script no Linux

.

Qual é o seu usuário?

.

Se você não tem certeza qual é o seu usuário, use o comando "whoami" sem aspas, para saber.

.

Como o prompt de usuário normal pode ser diferente para cada um, podemos em algum momento usar "prompt$" para indicar o prompt da linha de comando.

.

ESCOLHER O DIRETÓRIO ONDE COLOCAR O SCRIPT

Para que o script possa ser executado de qualquer parte do sistema, mova-o para um diretório que esteja no seu PATH. Para ver quais são estes diretórios, abra agora o terminal pelo menu do sistema e digite o comando:

echo $PATH

.

Se não tiver permissão de mover para um diretório do PATH, deixe-o dentro de seu diretório pessoal ($HOME). Digite no terminal: $HOME

.

CRIAR O ARQUIVO E COLOCAR NELE OS COMANDOS

Abra pelo menu do sistema o editor de texto gedit, pluma, leafpad, mousepad ou outro editor de textos de sua preferência para colocar todos os comandos dentro do arquivo.

.

COLOQUE A CHAMADA DO SHELL NA PRIMEIRA LINHA

A primeira linha do script deve ser:

#!/bin/bash

Para que ao ser executado, o sistema saiba que é o bash quem irá interpretar estes comandos.

.

TORNE O SCRIPT UM ARQUIVO EXECUTÁVEL

Use o seguinte comando para que seu script seja reconhecido pelo sistema como um comando executável:

chmod +x nome-do-teu-shellscript.sh

.

Para permitir que todos os usuários possam executar o script:

chmod a+x nome-do-teu-shellscript.sh

.

EXECUTE O SCRIPT

./nome-do-teu-shellscript.sh (Aqui "./" representa o diretório atual)

/home/seu-usuário/bin/nome-do-teu-shellscript.sh (Aqui informa onde está o script para que o bash execute em outra pasta)

.

BASH EXECUTANDO COMANDOS

Shell script é uma linguagem de script usada em vários sistemas operacionais, com diferentes dialetos, dependendo do interpretador de comandos utilizado.

Um exemplo de interpretador de comandos é o bash, usado na grande maioria das distribuições GNU/Linux.

A maior parte dos usuários classificam shell script como uma linguagem de fácil aprendizagem. O primeiro passo é, saber o que se deseja fazer, então ver qual o código que executa este comando em shell e aí criar, basta escrever o código em algum editor de texto e salvar. Veja só por exemplo, que de tempos em tempos você quer saber informações do sistema, instalar programas, remover programas, converter/alterar arquivos, fazer backups, adicionar informações, remover informações, etc.

.

AGORA ABRE O TERMINAL E DIGITA COMANDOS, POR EXEMPLO, DIGITE ESTES COMANDOS ABAIXO UM DE CADA VEZ:

echo

ls

echo ''

echo ""

echo "Olá!"

printf 'Bem vindo ao bash!' (Aperte a tecla enter e digite: ls)

echo '#!/bin/bash'

echo "#!/bin/bash"

echo ; echo "Olá!" ; echo

echo -e 'Bom\nDia\nMundo!'

echo "Hello world!"

echo "Hello "world"!"

echo "Hello \"world\"!"

printf "Hello world" (Aperte a tecla enter e digite: cd ~)

pwd

ls -t

sleep 7

echo ; echo 'Olá!' ; sleep 3 ; ls -t

free -h -t

free -th

sleep 4

date

cal

du -h

uptime

df -h

clear

free -tmlh

df -a -h

df -k -l

df -T -m

echo ; whoami ; echo

ls ; echo ; pwd ; echo

echo ; ls -at ; echo

du *

ls -lah

du -hcs

du -ach

du -Sh

du -Sk

clear

echo ; echo 'df: Relata o espaço de disco usado pelo sistema (Usado e Livre)' ; echo

ls -hat

echo ; echo "du: Relata o espaço utilizado no disco de tal arquivo ou diretório" ; echo

whereis bash

VALOR="Linux"

echo $VALOR

echo $VALOR $VALOR

VALOR='ls -t'

$VALOR

echo $VALOR

VALOR='free -h -t'

$VALOR

echo $VALOR

echo VALOR

read VALOR (aperte a tecla enter, digite: "ls" sem aspas e aperte enter.)

$VALOR

read VALOR (aperte a tecla enter, digite: "uptime" sem aspas e aperte enter.)

$VALOR

echo ; $VALOR ; echo ; $VALOR ; echo

echo ; $VALOR ; sleep 4 ; echo ; $VALOR ; echo

unset VALOR

echo ; $VALOR

$VALOR

clear

echo -e '\nOlá!\nVamos\nSaber\nOs\nComandos\ndo\nShellscript Linux!'

clear ; echo -e '\n \nOlá!\n \nVamos\n \nSaber\n \nOs\n \nComandos\n \ndo\n \nShellscript Linux!\n'

HOJE=$(lsblk)

echo "Informação sobre dispositivos de bloco: $HOJE"

unset HOJE

echo $HOJE

echo $((2*3))

echo $((2*4-2/2+3))

VALOR=44

echo $((VALOR*1))

echo $((VALOR*2))

echo $((VALOR*3))

VALOR=$((VALOR+1))

echo $VALOR

VALOR=$((VALOR+11))

echo $VALOR

VALOR=$((VALOR+1))

echo $VALOR

VALOR=$((VALOR+11))

echo $VALOR

unset VALOR

echo $VALOR

VALOR=$(uname -a)

echo $VALOR

HOJE=$(arch)

echo $HOJE

echo "Informação sobre o kernel: $VALOR" ; echo ; echo "Informação sobre a arquitetura do sistema: $HOJE"

echo 'Informação sobre o kernel: $VALOR' ; echo ; echo 'Informação sobre a arquitetura do sistema: $HOJE'

unset VALOR

unset HOJE

echo "Informação sobre o kernel: $VALOR" ; echo ; echo "Informação sobre a arquitetura do sistema: $HOJE"

echo 'Informação sobre o kernel: $VALOR' ; echo ; echo 'Informação sobre a arquitetura do sistema: $HOJE'

printf "%-5s %-10s %-4s\n" No Nome Pontos

printf "%-5s %-10s %-4.2f\n" 1 Marta 8

printf "%-5s %-10s %-4.2f\n" 2 Joel 9

printf "%-5s %-10s %-4.2f\n" 3 Carlos 7

clear

exit

.

Muito bom que você digitou um comando de cada vez!!!

O comandos mais longos pode copiar e colar no terminal se quiser, mas no início seria melhor digitar...

Saiba que a partir deste momento você já está entendendo coisas extremamente úteis para escrever shellscript usando o Bash!

Uma coisa interessante sobre os comandos acima, é que para estudar eles, você não precisa estar conectado a internet.

Os comandos acima oferecem informações interessantes e úteis. Podemos colocar todos eles em um só script e executar. Dependendo do caso, é mais fácil que digitar um a um de cada vez toda vez que precisar.

.

SE PUDER, ANTES DE CONTINUAR EXECUTE OS COMANDOS ACIMA QUE TE CHAMARAM MAIS A ATENÇÃO DE NOVO POIS, EXECUTAR ELES É MUITO DIDÁTICO. NADA MELHOR QUE APRENDER PRATICANDO.

.

ASPAS SIMPLES ' E ASPAS DUPLAS ":

Aspas duplas permitem interpretar caracteres especiais.

Aspas simples desabilitam esta interpretação.

.

CARACTERES DE ESCAPE:

echo "Hello \"world\"!"

.

TODO SCRIPT ESCRITO PARA RODAR NO BASH COMEÇA COM:

#!/bin/bash

Após "#!/bin/bash" de um espaço entre linhas e então pode começar a digitar comandos.

.

Exemplo:

#!/bin/bash

clear

echo ; date ; echo ; sleep 4

echo ; cal ; echo ; sleep 4

echo ; uptime ; echo ; sleep 4

echo ; df -h ; echo ; sleep 4

echo ; free -html ; echo ; sleep 4

echo ; whoami ; echo ; sleep 4

echo ; pwd ; echo ; sleep 4

echo ; ls -at ; echo ; sleep 4

echo ; whereis bash ; echo ; sleep 4

echo ; echo 'Este é o fim do script 01-script.sh' ; echo ; sleep 4

exit

# Fim do script

.

ESTE SCRIPT ÚTIL E INOFENSIVO ACIMA SERÁ SALVO NA PASTA HOME, A PASTA DA CASINHA, USANDO UM EDITOR DE TEXTO COM O NOME DE:

01-script.sh

.

Posso melhorar/tornar mais amigável este script acima explicando sobre cada comando:

#!/bin/bash

clear

echo ; echo 'Hoje é data:' ; echo ; sleep 2

echo ; date ; echo ; sleep 4

echo ; echo 'Hoje pelo calendário é:' ; echo ; sleep 2

echo ; cal ; echo ; sleep 4

echo ; echo 'Esta máquina está funcionando a:' ; echo ; sleep 2

echo ; uptime ; echo ; sleep 4

echo ; echo 'Sobre o tamanho desta pasta:' ; echo ; sleep 2

echo ; df -h ; echo ; sleep 6

echo ; echo 'Sobre a memória RAM:' ; echo ; sleep 2

echo ; free -html ; echo ; sleep 6

echo ; echo 'Você está logado como:' ; echo ; sleep 2

echo ; whoami ; echo ; sleep 4

echo ; echo 'Você está em:' ; echo ; sleep 2

echo ; pwd ; echo ; sleep 4

echo ; echo 'Neste diretório/pasta tem:' ; echo ; sleep 2

echo ; ls -at ; echo ; sleep 6

echo ; echo 'O Bash está em:' ; echo ; sleep 2

echo ; whereis bash ; echo ; sleep 4

echo ; echo 'Este é o fim do script 01-script.sh' ; echo ; sleep 4

exit

# Fim do script

.

No Linux o script deve ter permissão de execução, isto pode ser feito abrindo o terminal pelo menu do sistema e executando o comando:

chmod +x 01-script.sh

.

Depois de salvo você tem que executar o arquivo, dessa forma:

./01-script.sh

.

Viu alguma utilidade neste pequeno script?

Então siga adiante.

.

IMPORTANTE:

Para estudar shell script tem que ser como usuário normal. Se você está acessando o sistema como usuário administrador (root), saia e entre como um usuário normal. É muito perigoso estudar shell usando o superusuário, você pode danificar o sistema com um comando errado.

Ok, continuemos.

.

Para exibir um manual do bash ou mesmo do comando 'chmod', digite na linha de comando:

man bash

man chmod

.

É possível executar o arquivo mesmo sem modificar a permissão de execução, por exemplo, se for um arquivo escrito para ser executado pelo bash, usar:

sh ./"Nome do arquivo, sem aspas"

.

SHELL

É importante saber o que é um Shell.

Na linha de comandos de um shell, podemos utilizar diversos comandos um após o outro, ou mesmo combiná-los numa mesma linha.

Se colocarmos diversas linhas de comandos em um arquivo texto simples, teremos em mãos um Shell Script, ou um script em shell, já que Script é uma descrição geral de qualquer programa escrito em linguagem interpretada, ou seja, não compilada.

Outros exemplos de linguagens para scripts são o PHP, Perl, Python, JavaScript e muitos outros. Podemos então ter um script em php, um script perl e assim em diante.

Uma vez criado, um ShellScript pode ser reutilizado quantas vezes for necessário.

Seu uso, portanto, é indicado na automação de tarefas que serão realizadas mais de uma vez.

Todo sistema Unix e similares são repletos de scripts em shell para a realização das mais diversas atividades administrativas e de manutenção do sistema.

Os arquivos de lote (batch - arquivos *.bat) do Windows são também exemplos de ShellScripts, já que são escritos em linguagem interpretada e executados por um Shell do Windows, em geral o command.com ou hoje em dia o cmd.exe.

Os Shells do Unix, porém, são inumeras vezes mais poderosos que o interpretador de comandos do Windows, podendo executar tarefas muito mais complexas e elaboradas.

OS SCRIPTS SHELL PODEM SER AGENDADOS PARA EXECUÇÃO ATRAVÉS DA TABELA CRONTAB, ENTRE OUTRAS COISAS.

É uma ferramenta indispensável aos administradores de sistemas Unix.

O Shell mais comum e provavelmente o que possui mais scripts escritos para ele é também um dos mais antigos e simples, o sh.

Este shell está presente em todo o sistema tipo Unix, incluído o Linux, FreeBSD, AIX, HP-UX, OpenBSD, Solaris, NetBSD, Irix, etc. Por ser o shell nativo mais comum é natural que se prefira escrever scripts para ele, tornando o script mais facilmente portável para outro sistema.

Os Shells não estão diretamente associados a um ou outro tipo de Unix, embora várias empresas comerciais tenham suas próprias versões de Shell. No software livre o Shell utilizado em um sistema em geral é exatamente o mesmo utilizado em outro. Por exemplo, o bash encontrado no Linux é o mesmo shell bash encontrado no FreeBSD e pode também facilmente ser instalado no Solaris, Windows através do Cygwin [1] ou outros sistemas Unix comerciais para passar a ser utilizado como interface direta de comandos ou como interpretador de scripts. O mesmo acontece com o tcsh e vários outros shells desenvolvidos no modelo de software livre.

.

INTERAGIR COM O USUÁRIO

.

Para o script ficar mais completo, vamos colocar uma interação mínima com o usuário, pedindo uma confirmação antes de executar os comandos.

.

#!/bin/bash

clear

echo "Vou buscar os dados do sistema. Posso continuar? [S/n] "

read RESPOSTA

test "$RESPOSTA" = "n" && exit

echo ; echo "Data e Horário:" ; echo

date

echo

echo "Uso do disco:" ; echo

df -ht

echo

echo "Usuários conectados:" ; echo

w

echo ; echo "Seu nome de login é:"

whoami

echo

exit

# Fim do script

.

O comando "read" leu o que o usuário digitou e guardou na variável RESPOSTA. Logo em seguida, o comando "test" verificou se o conteúdo dessa variável era "n". Se afirmativo, o comando "exit" foi chamado e o script foi finalizado. Nessa linha há vários detalhes importantes:

O conteúdo da variável é acessado colocando-se um cifrão "$" na frente

O comando test é útil para fazer vários tipos de verificações em textos e arquivos

O operador lógico "&&", só executa o segundo comando caso o primeiro tenha sido OK. O operador inverso é o "||"

.

MELHORAR O CÓDIGO DO SCRIPT

Com o tempo, o script vai crescer, mais comandos vão ser adicionados e quanto maior, mais difícil encontrar o ponto certo onde fazer a alteração ou corrigir algum erro. Para poupar horas de estresse, e facilitar as manutenções futuras, é preciso deixar o código visualmente mais agradável e espaçado, e colocar comentários esclarecedores.

.

#!/bin/bash

# nome-do-script - script que mostra informações sobre o sistema

# Autor: Fulano da Silva

# Pede uma confirmação do usuário antes de executar

clear

echo "Vou buscar os dados do sistema. Posso continuar? [S/n]"

read RESPOSTA

# Se ele digitou 'n', vamos interromper o script

test "$RESPOSTA" = "n" && exit

# O date mostra a data e a hora correntes

sleep 3 ; echo "Data e Horário:" ; echo

date

sleep 3

echo

# O df mostra as partições e quanto cada uma ocupa no disco
echo "Uso do disco:"

sleep 3

echo

df

echo

sleep 6

# O w mostra os usuários que estão conectados nesta máquina

echo "Usuários conectados:"

sleep 3

echo

w

sleep 3

echo

# Fim do script

.

Basta iniciar a linha com um "#" e escrever o texto do comentário em seguida. Estas linhas são ignoradas pelo shell durante a execução. O cabeçalho com informações sobre o script e seu autor também é importante para ter-se uma visão geral do que o script faz, sem precisar decifrar seu código. Também é possível colocar comentários no meio da linha # como este

.

CARACTERÍSTICAS

.

OS SCRIPTS SHELL PODEM CONTER ESTRUTURAS DE PROGRAMAÇÃO TAIS COMO:

.

ESTRUTURAS DE DECISÃO (if)

Recurso utilizado para dar sequencia em fluxos de execução baseado decisões. Cuja sintaxe é:

- Condição Verificada é o teste que definirá se controle deve ser passado para dentro do bloco then, observe que esse teste é feito sobre a saída de um comando.
- Ação são comandos a serem executados em caso verdadeiro da condição verificada.

.

OPERADORES PARA NÚMEROS

-eq Verifica se é igual,
-ne Verifica se é diferente,
-lt Verifica se é menor,
-gt Verifica se é maior,
-le Verifica se é menor ou igual,
-ge Verifica se é maior ou igual.

.

OPERADORES PARA TEXTO

!= Verifica se é diferente,
= Verifica se é igual.

.

OPERADORES LÓGICOS

! Lógica NOT,
-o Lógica OU, (OR) ou ||,
-a Lógica E, (AND) ou &&.

.

OPERADOR PARA arquivos/

-d Verifica se é diretório,
-f Verifica se é arquivo,
-e Verifica se existe.

.

Ex:

# !/bin/baxh
# Uso de Estrutura de Decisão
clear

echo 'opções'
echo '======'
echo ' -> Data do Sistema'
echo ' -> Uso do Sistema'

read opcao

if [ "$opcao" -eq 1 ]
then
echo 'Data do sistema: ' && date

elif [ "$opcao" -eq 2 ]
then

echo 'Uso do disco: ' && df -Th
fi

# Fim do script

.

ESTRUTURAS DE REPETIÇÃO (FOR)(WHILE)

.

ESTRUTURA DE REPETIÇÃO FOR

Permite que ações de iteração sejam executadas sobre determinados comandos ou variáveis até que a condição seja satisfeita.

# !/bin/bash

clear

echo "DIAS DA SEMANA"
for dia in seg ter qua qui sex sab dom
do
echo "$dia"
done

# Fim do script

.

ESTRUTURA DE REPETIÇÃO WHILE

Em situações onde sabemos até onde o loop irá realizar uma contagem o ideal é usar o for entretanto em cenarios onde a iteração deve cessar somente após se satisfazer uma condição o uso do laço while é mais indicado. Ex:

# /bin/bash

clear
var=1
while [ $var -le 7 ]
do
echo "Valor de var: $var"
var=$((var+1))
done

# Fim do script

.

FUNÇÕES E ARGUMENTOS

Ex:

# !/bin/bash
# REALIZAR BACKUP DO DIR

echo -e " \033[1;33m Digite o caminho de origem.: \033[0m "
read DIR_ORIGEM

clear

echo -e " \033[1;34m Digite o caminho de destino.: \033[0m "
read DIR_DESTINO

clear

verifica_argumentos(){

if [ $# -lt 1 ];
then
echo "Faltou informar um dos argumentos (parametros) necessarios!"
exit 1
fi
}

copia_arquivos(){

verifica_argumentos

clear

echo "Realizando backup..."

#Verificando se o dir de destino existe

if ! [ -d $DIR_DESTINO ]
then
mkdir $DIR_DESTINO
echo "Diretorio de Destino Criado"
fi

#COPIANDO ARQUIVOS

for arq in `ls $DIR_ORIGEM`
do
cp /$DIR_ORIGEM/$arq $DIR_DESTINO/$arq.bak
done

}

copia_arquivos

# Fim do script

DEFINIÇÕES DE VARIÁVEIS E ESCOPO DESTAS

Variáveis são definidas pela nomenclatura NOME_VARIAVEL="Valor da Variável". O valor pode ser tanto numérico quanto texto.

Nome="Joel"

Se quisermos acessá-la, basta fazer referência a ela com o caractere $ (cifrão) antes do nome: o comando echo $Nome, por exemplo, retornará a palavra "Joel".

Se quiser sabe informações sobre os sistemas de arquivo nos quais cada ARQUIVO reside ou, por padrão, sobre todos os sistemas de arquivos posso abrir um terminal e digitar:

VarInfo="df -h"

Depois digito no terminal "$VarInfo" sem aspas.

.

VARIÁVEIS DE AMBIENTE

As variáveis de ambiente independem da definição do usuario. Elas são criadas automaticamente, no momento em que se faz o login no sistema.

Ex:

PATH: define diretórios de procura por programas executados no shell;
USER: informa o nome do usuário do shell;
HOME: informa o caminho do diretório home do usuário;
PWD: diretório atual;

.

As variáveis são a base de qualquer script. É dentro delas que os dados obtidos durante a execução do script serão armazenados. Para definir uma variável, basta usar o sinal de igual "=" e para ver seu valor, usa-se o "echo":

.

Execute estes comandos abaixo no terminal:

.

VARIAVEL="um dois tres"

echo $VARIAVEL

echo $VARIAVEL $VARIAVEL

.

Para remover a variável acima:

unset VARIAVEL

.

Teste:

echo $VARIAVEL

.

É possível armazenar a saída de um comando dentro de uma variável. Ao invés de aspas, o comando deve ser colocado entre "$(...)", execute no terminal os comandos abaixo:

HOJE=$(date)

echo "Hoje é: $HOJE"

unset HOJE

echo $HOJE

HOJE=$(ls)

echo "O conteúdo desta pasta tem: $HOJE"

unset HOJE

echo $HOJE

HOJE=$(free -hmt)

echo "Informando sobre a memória desta máquina: $HOJE"

unset HOJE

echo $HOJE

.

Exemplos de uso do shell script:

Apagar arquivos velhos - Apagar periodicamente arquivos mais velhos que 30 dias do diretório /tmp:

#!/bin/bash

cd /tmp
find . -type f -mtime +30 -delete

# Fim do script

Este seria o conteúdo de um shell script que sempre que fosse executado apagaria arquivos com data de modificação maior que 30 dias a partir do diretório /tmp do sistema de arquivos.

Notem que ele é nada mais do que uma associação de 2 comandos (cd e find) em um arquivo para facilitar a repetição da tarefa. Este poderia ser, por exemplo, o conteúdo do arquivo /bin/limpatmp.sh e poderíamos chamar este script pela linha de comandos sempre que desejássemos repetir esta ação:

$ limpatmp.sh

Onde o símbolo "$" representa o prompt de comandos. Do ponto de vista do usuário este seria mais um comando disponível para uso.

Os scripts em shell são também muito empregados junto à inicialização do sistema (para auto-iniciar tarefas) ou como mini-aplicativos, que facilitam tarefas dos usuários, tais como montagem de dispositivos, menus de ajuda, etc.

Sua primeira linha obrigatoriamente começa com um "#!" (que não se deve confundir com um comentário qualquer, pois realmente é uma exceção; este par se chama, em inglês, de shebang), informando diretamente ao núcleo (kernel) qual interpretador ele deverá usar, juntamente com seu caminho, de acordo com a necessidade de cada caso. Exemplo:

#!/bin/bash

Em seguida, são adicionados os comandos desejados, um por linha, ou separados por ponto e vírgula. Exemplo:

mount -t reiserfs /dev/hda1 /mnt/hda1

ls /mnt/hda1

cp -r /mnt/hda1/* /home/user/backup
umount /dev/hda1

Por fim, dá-se a permissão de execução a este arquivo de texto simples ("chmod +x arquivo").

.

DATA ANTERIOR

.

#!/bin/bash

# Função em Bash para retornar a data anterior, levando em conta o mês e ano.

fn_data_anterior()
{
DIA=$D
MES=$M
ANO=$A

# Dado DIA, MES e ANO numéricos, obtém a data do dia anterior

DIA=`expr $DIA - 1`
if [ $DIA -eq 0 ]; then
MES=`expr $MES - 1`
if [ $MES -eq 0 ]; then
MES=12
ANO=`expr $ANO - 1`
fi
DIA=`cal $MES $ANO`
DIA=`echo $DIA | awk '{ print $NF }'`
fi
}

ano=`date +%Y`;
mes=`date +%m`;
let dia=10\#`date +%d`;

if (( $dia". Para guardar a saída do comando anterior no arquivo "saida", basta fazer:

cat /etc/passwd | grep root | cut -c1-10 > saida

cat saida

.

O COMANDO TEST

O canivete suíço dos comandos do shell é o "test", que consegue fazer vários tipos de testes em números, textos e arquivos. Ele possui várias opções para indicar que tipo de teste será feito, algumas delas:

-lt Núm. é menor que (LessThan)

-d É um diretório

-gt Núm. é maior que (GreaterThan)

-f É um arquivo normal

-le Núm. é menor igual (LessEqual)

-r O arquivo tem permissão de leitura

-ge Núm. é maior igual (GreaterEqual)

-s O tamanho do arquivo é maior que zero

-eq Núm. é igual (EQual)

-w O arquivo tem permissão de escrita

-ne Núm. é diferente (NotEqual)

-nt O arquivo é mais recente (NewerThan)

= String é igual

-ot O arquivo é mais antigo (OlderThan)

!= String é diferente

-ef O arquivo é o mesmo (EqualFile)

-n String é não nula

-a E lógico (AND)

-z String é nula

-o OU lógico (OR)

.

SCRIPT QUE TESTA ARQUIVOS

Tente fazer um script "testa-arquivos", que pede ao usuário para digitar um arquivo e testa se este arquivo existe. Se sim, diz se é um arquivo ou um diretório.

.

CONCEITOS MAIS AVANÇADOS

.

If, for e while

.

Assim como qualquer outra linguagem de programação, o shell também tem estruturas para se fazer condicionais e loop. As mais usadas são if, for e while.

.

Então daqui por diante, sabemos o básico, o necessário para se fazer um script de funcionalidade mínima. E este mínimo pode fazer coisas incríveis.

.

Ex:

if COMANDO
then
comandos
else
comandos
fi

# Fim do script

Ex:

for VAR in LISTA
do
comandos
done

# Fim do script

Ex:

while COMANDO
do
comandos
done

# Fim do script

.

Diferente de outras linguagens, o if testa um comando e não uma condição. Porém como já conhecemos qual o comando do shell que testa condições, é só usá-lo em conjunto com o if. Por exemplo, para saber se uma variável é maior ou menor do que 10 e mostrar uma mensagem na tela informando:

.

Ex:

if test "$VARIAVEL" -gt 10
then
echo "é maior que 10"
else
echo "é menor que 10"
fi

# Fim do script

.

Há um atalho para o test , que é o comando [. Ambos são exatamente o mesmo comando, porém usar o [ deixa o if mais parecido com o formato tradicional de outras linguagens:

.

Ex:

if [ "$VARIAVEL" -gt 10 ]
then
echo "é maior que 10"
else
echo "é menor que 10"
fi

# Fim do script

.

Se usar o [, também é preciso fechá-lo com o ], e sempre devem ter espaços ao redor. É recomendado evitar esta sintaxe para diminuir suas chances de erro.

.

Já o while é um laço que é executado enquanto um comando retorna OK. Novamente o test é bom de ser usado. Por exemplo, para segurar o processamento do script enquanto um arquivo de lock não é removido:

.

Ex:

while test -f /tmp/lock
do
echo "Script travado..."
sleep 1
done

# Fim do script

.

Ex:

E por fim, o for percorre uma lista de palavras, pegando uma por vez:

for numero in um dois três quatro cinco
do
echo "Contando: $numero"
done

# Fim do script

.

Uma ferramenta muito útil para usar com o for é o seq, que gera uma seqüência numérica.

.

Para fazer o loop andar 10 passos, pode-se fazer:

for passo in $(seq 10)

.

O mesmo pode ser feito com o while, usando um contador:

i=0
while test $i -le 10
do
i=$((i+1))
echo "Contando: $i"
done

# Fim do script

.

Até Breve

.

.

🙂

.

Scientific Linux – Guia Pós Instalação – 2017

 

Uma Distribuição especial é o Scientific Linux
.
.
O Scientific Linux é patrocinado por:
.
.
http://fnal.gov/
.
.
Para saber quem faz o Scientific Linux visito:
.
https://www.scientificlinux.org/about/who-makes-scientific-linux/
.
.
O Scientific Linux 2017 do Fermilab tem suas origens no RedHat Enterprise Linux assim como o CentOS e Fedora.
.
.
Posso usar o Scientific Linux assim que acabar de instalar, mas para obter o melhor do sistema é necessário fazer alguns updates, instalar repositórios, instalar alguns pacotes e programas.
.
.
O meu objetivo é obter o melhor so sistema usando o terminal do Linux. O Bash. A única coisa que eu tenho controle são as minhas atitudes e a única coisa que posso dar para meu próximo é informação. A melhor que eu for capaz de oferecer.
.
.
Como sou muito esquecido, sempre antes de iniciar um artigo que me guia e me ensina a melhorar algum sistema Linux, tento saber a sintaxe, aprendo alguns comandos usados pelo sistema, depois crio um resumo com comandos básicos e só então inicio o assunto pós-instalação. É assim que eu faço para ter onde correr quando o tempo passar, e eu precisar relembrar de algo.
.
.
Executo este tutorial por minha conta e risco.
.
.
Parto do princípio que eu já instalei o Scientific Linux no meu computador. Isto para mim é fato.
.
.
O meu ponto de vista aqui é que eu instalei o mínimo possível, ou seja, fiz uma instalação Netinstall.
.
.
Eu pesquiso sobre:
.
RedHat Enterprise
.
.
ScientificLinux – Sintaxe, Lista de comandos, comandos básicos e Tutorial Pós-Instalação.
.

.

A sintaxe do comando YUM

.

# Usual sintaxe para yum #

root@geek [~]# yum [options] [commands] [package name]

 

# Comandos yum mais populares #

root@geek [~]# [install remove update search info check-update clean repolist list history

 

# Localização dos arquivos de repositório yum #

root@geek [~]# /etc/yum.repos.d

 

# Localização do cache do yum #

root@geek [~]# /var/cache/yum

 

# Remover um único pacote #

root@geek [~]# yum remove httpd

ou

root@geek [~]# yum erase httpd

.
.
YUM – Lista de Comandos
.
.
Usage: yum [options] COMMAND

Lista de Comandos:

check Procurar por problemas no rpmdb

check-update Verifica por atualizações de pacotes disponíveis

clean Remove os dados do cache

deplist Lista as dependências de um pacote

distribution-synchronization Sincronizar os pacotes instalados para as últimas versões disponíveis

downgrade desatualizando um pacote

erase Remove um ou mais pacotes do seu sistema

fs Creates filesystem snapshots, or lists/deletes current snapshots.

fssnapshot Creates filesystem snapshots, or lists/deletes current snapshots.

groups Display, or use, the groups information

help Exibe uma mensagem de uso para ajuda

history Exibir ou usar o histórico de transações

info Mostra detalhes sobre um pacote ou grupos de pacotes

install Instala um ou mais pacotes no seu sistema

langavailable Check available languages

langinfo List languages information

langinstall Install appropriate language packs for a language

langlist List installed languages

langremove Remove installed language packs for a language

list Lista um pacote ou grupos de pacotes

load-transaction Carregar uma transação salva de um nome de arquivo

makecache Gera o cache de metadados

provides Localiza qual pacote fornece o valor dado

reinstall reinstala um pacote

repo-pkgs Treat a repo. as a group of packages, so we can install/remove all of them

repolist Exibe os repositórios de software configurados

search Pesquisa detalhes do pacote para a string fornecida

shell Executa um shell interativo do yum

swap Simple way to swap packages, instead of using shell

update Atualiza um ou mais pacotes do seu sistema

update-minimal Works like upgrade, but goes to the ‘newest’ package match which fixes a problem that affects your system

updateinfo Acts on repository update information

upgrade Atualiza pacotes levando em conta os obsoletos

version Exibe uma versão para a máquina e/ou os repositórios disponíveis.
.
.

Opções:

-h, –help mostrar essa mensagem ajuda e sai

-t, –tolerant ser tolerante com os erros

-C, –cacheonly executar por completo a partir do cache do sistema,
não atualiza o cache

-c [config file], –config=[config file]
configurar localização do arquivo

-R [minutes], –randomwait=[minutes]
Tempo máximo de espera do comando

-d [debug level], –debuglevel=[debug level]
nível de depuração na saída

–showduplicates mostrar duplicados em repos e em comandos de
pesquisa/listagem

-e [error level], –errorlevel=[error level]
nível de erro na saída

–rpmverbosity=[debug level name]
nível de depuração na saída para o rpm

-q, –quiet operação discreta

-v, –verbose operação detalhada

-y, –assumeyes responder sim para todas as perguntas

–assumeno answer no for all questions

–version mostrar versão do Yum ao sair

–installroot=[path] definir raiz de instalação

–enablerepo=[repo] habilitar um ou mais repositórios (curingas são
permitidos)

–disablerepo=[repo] desabilitar um ou mais repositórios (curingas são
permitidos)

-x [package], –exclude=[package]
excluir pacote(s) por nome ou glob

–disableexcludes=[repo]
desabilitar a exclusão a partir do principal, para um
repositório ou para tudo

–disableincludes=[repo]
disable includepkgs for a repo or for everything

–obsoletes Habilitar processo de obsolescência durante as
atualizações

–noplugins desabilitar plugins do Yum

–nogpgcheck desabilitar verificação de assinaturas gpg

–disableplugin=[plugin]
desabilitar plugins pelo nome

–enableplugin=[plugin]
habilita plugins pelo nome

–skip-broken ignorar pacotes com problemas de solução de
dependências

–color=COLOR controla o uso da cor

–releasever=RELEASEVER
defina o valor de $releasever nos arquivos repo e yum
config

–downloadonly don’t update, just download

–downloaddir=DLDIR specifies an alternate directory to store packages

–setopt=SETOPTS Configurando opções arbitrárias de repositório e
configurações.

–bugfix Include bugfix relevant packages, in updates

–security Include security relevant packages, in updates

–advisory=ADVS, –advisories=ADVS
Include packages needed to fix the given advisory, in
updates

–bzs=BZS Include packages needed to fix the given BZ, in
updates

–cves=CVES Include packages needed to fix the given CVE, in
updates

–sec-severity=SEVS, –secseverity=SEVS
Include security relevant packages matching the
severity, in updates
.
.
YUM – Comandos Básicos

 

Update

sudo yum update

 

Upgrade

sudo yum upgrade

 

Instalar

sudo yum install (nome_do_pacote)

 

Buscar

sudo yum search (nome, adj, subst)

 

Procura erros no rpmdb

sudo yum check

 

Verifica atualização

sudo yum check -update

 

Lista as dependências de um pacote

sudo yum deplist

 

Sincroniza os pacotes instalados para as últimas versões disponíveis

sudo yum -y distribution-synchronization

 

Trabalha como o upgrade , mas vai para os pacotes mais novos possíveis compatíveis que resolvem um problema que afete teu sistema.

sudo yum -y update-minimal

 

Faz upgrade do sistema

sudo yum -y upgrade

 

Obs:

Nos comandos acima, o -y é para não ter que dizer sim.
.
.
Comandos uteis:

sudo yum check ; sudo yum check-update ; sudo yum -y distribution-synchronization ; sudo yum -y update ; sudo yum -y update-minimal ; sudo yum -y upgrade

 

 

 

Scientifi-Linux Pós – Instalação – Scientific-Linux Pós – Instalação

.

A primeira coisa é proteger o sistema atualizando-o. Faça update e upgrade (obrigatório). Faça isto pelo menos a cada 7 dias. Sem isto com o passar do tempo, seu sistema fica vulnerável e instável.

Abra o terminal com clique direito do mouse

$ sudo yum -y distribution-synchronization ; sudo yum -y update ; sudo yum -y upgrade ; sudo yum -y update-minimal

 

 

Pode-se executar comandos com não administrador e como administrador. O simbolo no terminal para não administrador é $ e o simbolo para administrador é # .

No modo administrador não se usa o prefixo sudo e no modo não administrador usa-se o prefixo sudo.

 

Exemplo abaixo:

Administrador

digite no terminal:

$ su

digite tua senha.

<enter>

# yum install (nome_do_programa)

 

 

Não administrador

$ sudo yum install (nome_do_programa)

digite a tua senha

<enter>

confirme a instalção com Y ou S depende da linguagem escolhida.

Aguarde o programa ser instalado.

 

O modo administrador é apenas para fazer alterações no sistema, navegar em modo administrador expõe o usuário a todos os perigos da internet, usar sudo em modo administrador pode danificar o sistema.
.
.
Comandos para melhorar o sistema:

# yum repolist ; yum makecache ; yum update ; yum update-minimal ; yum update info ; yum upgrade ; yum version ; yum groups ; yum distribution-synchronization ; exit

.
.
Multimidia, codecs, MP3 & DvD

 

$ sudo yum install gstreamer gstreamer-plugins-base gstreamer-plugins-good gstreamer-plugins-bad-free ; sudo yum install gstreamer-plugins-bad gstreamer-plugins-ugly gstreamer-ffmpeg ; sudo yum install mplayer mplayer-gui ; sudo yum install libdvdnav libdvdplay lsdvd ; sudo rpm -Uvh http://rpm.livna.org/livna-release.rpm ; sudo yum install vlc ; sudo yum install dragon.x86_64 libmtp.x86_64 totem.x86_64 ; sudo # yum install mencoder.x86_64 abcde.noarch flac.x86_64 python-pypng.noarch x264.x86_64 x265.x86_64 ; sudo yum install rosa-media-player.x86_64

.
.
Instalando VLC

O VLC depende da instalação de repositórios. O Epel e o Nux Dextop. Use os Links abaixo:

 

$ sudo rpm -Uvh https://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-8.noarch.rpm

 

$ sudo rpm -Uvh http://li.nux.ro/download/nux/dextop/el7/x86_64/nux-dextop-release-0-5.el7.nux.noarch.rpm

 

 

Pode agora instalar o VLC

$ sudo yum install vlc

 

 

Caso queira, instale o ótimo repositório da comunidade, o Community Enterprise Linux Repository

$ sudo rpm -Uvh http://www.elrepo.org/elrepo-release-7.0-2.el7.elrepo.noarch.rpm

.
.
Instale reconhecimento de sistemas de arquivos para drivers externos Windows NTFS (HD externo)

$ sudo yum install ntfs-3g.x86_64 ntfs-3g-devel.x86_64 ntfsprogs.x86_64 ; sudo yum update ; sudo yum upgrade

.
.
Intale e desenhe, faça desenhos

$ sudo yum install inkscape.x86_64 tuxpaint.x86_64 pinta.x86_64 xfig.x86_64

.
.
Instale Telegram e Franz para se comunicar com todo o mundo

Telegram

$ sudo yum install telegram-cli.x86_64

 

Franz
$ sudo yum install libXtst6 libffmpeg.so GConf2 mozilla-nss franz.x86_64

.
.
Instale LIVNA

$ sudo rpm -ivh http://rpm.livna.org/livna-release.rpm

.
.
Instalando Chromium

$ sudo yum install chromium

.
.
Icones e Temas
Instale Numix, Nuvola, Faience, Bluecurve, Mono, Hicolor Adwaita e Mate-Faenza icon-theme

 

$ sudo yum install numix-icon-theme.noarch numix-icon-theme-circle.noarch nuvola-icon-theme.noarch faience-icon-theme.noarch bluecurve-icon-theme.noarch adwaita-icon-theme.noarch mate-icon-theme-faenza.noarch hicolor-icon-theme.noarch inx-icon-theme.noarch mono-icon-theme.noarch
.
.
Arc-Icon-Theme
.
Icones e Temas (super-fácil)
Para Instalar Arc-Icon-Theme
,

$ sudo yum install arc-icon-theme.noarch

 

$ sudo yum install arc-pine-icon-theme.noarch

 

Ou:
,

$ sudo yum install arc-icon-theme.noarch arc-pine-icon-theme.noarch –skip-broken

 

###

Curiosidade (o arc-icon-theme-já está instalado):
,
Sabia que para instalar o arc-icon-theme…
,
Necessita-se das dependências:
.

 

gtk-engine-murrine (gtk-engine-murrine-git) ,gtk3 (gtk3-aqd, gtk3-donnatella, gtk3-light, gtk3-nobroadway-nowayland-nocolord, gtk3-optional-csd, gtk3-typeahead, gtk3-ubuntu, gtk3-ubuntu-multilib) ,git (git-git) (make)

 

.
Que irão suprir as necessidades de:
.

arc-firefox-theme (requires arc-gtk-theme)

arc-kde-git (requires gtk-theme-arc-git) (optional)

arc-suite (requires gtk-theme-arc-git) (optional)

kana-p-git

 

###

Comandos para melhorar o sistema:

# yum repolist ; yum makecache ; yum update ; yum update-minimal ; yum ch ; yum update info ; yum upgrade ; yum version ; yum groups

.
.
Proteja a sua privacidade e limpe o sistema.
.
Instale o bleachbit

 

$ sudo yum install bleachbi

 

.
.
Instalando Virtualbox

$ sudo yum install virtualbox

 

 

 

Scientific Linux 2017
Instalando Players

$ sudo yum install dragon.x86_64 libmtp.x86_64 totem.x86_64

 

 

 

Scientific Linux 2017
Instale Cliente de e-mail Thunderbird (gerenciador de e-mail)

$ sudo yum install thunderbird

 

 

 

Scientific Linux 2017
Instale navegadores de terminal e youtube-dl

$ sudo yum install youtube-dl elinks links w3m

 

 

 

Scientific Linux 2017
Instale deluge, gimp, mplayer, qbittorrent, smplayer, uget

$ sudo yum install deluge gimp mplayer qbittorrent smplayer uget

 

 

 

Scientific Linux 2017
Instale visualisador de PDF, epub reader, Hq reader

$ sudo yum install evince qpdfview fbreader calibre mcomix comix

 

 

 

Scientific Linux 2017
Instale conky-manager

 

$ sudo yum install lm_sensors-sensord.x86_64 lm_sensors.x86_64 xsensors.x86_64 qt5-qtsensors.x86_64 lm_sensors-libs.x86_64 collectd-sensors.x86_64

$ sudo yum install lm-sensors curl hddtemp sensors-detect

Confirme afirmativamente todas as perguntas do terminal.

 

Agora instale o conky-manager o repositório EPEL já deve estar instalado antes de fazer isto.

$ sudo yum install conky-manager

 

E pronto você ira ter o conky-manager em seu desktop, é só procurar em acessórios.

Mas pode-se fazer melhor com o conky. Você pode ter uma linda e harmoniosa área de trabalho com ele.

Caso queira tentar prossiga abaixo.

 

Verifique todos os sensores detectados com o comando abaixo.

$ sudo sensors

 

Exemplo do que irá aparecer:

$ sudo sensors

acpitz-virtual-0
Adapter: Virtual device
temp1: +44.0°C (crit = +104.0°C)
temp2: +44.0°C (crit = +104.0°C)

coretemp-isa-0000
Adapter: ISA adapter
Physical id 0: +44.0°C (high = +105.0°C, crit = +105.0°C)
Core 0: +43.0°C (high = +105.0°C, crit = +105.0°C)

 

 

Caso queira integrar o conky ao seu Desktop e isto é muito útil, primeira saiba que a configuração básica do conky está em /etc/conky/conky.conf então copie este arquivo para a pasta Home e renomeie-a como .conkyrc o ponto no início manterá este arquivo escondido.

 

$ cp /etc/conky/conky.conf /home/$USER/.conkyrc

 

Reinicie o conky para efetuar novas mudanças.

$ killall -SIGUSR1 conky

 

Você pode editar as configurações do conky no arquivo que está na pasta Home é bem fácil de entender.

 

Você pode usar scripts diferentes do conky básico. Você pode escrever seu próprio script conky ou pode usar um dos muitos scripts para conky da internet. Não use qualquer script que encontre. Abaixo dois links confiáveis de scripts conky.

 

http://ubuntuforums.org/showthread.php?t=281865

http://conky.sourceforge.net/screenshots.html

 

Você verá que cada captura possui um Hiperlink que irá te redirecionar ao arquivo script conky.

 

 

Testando um script conky

$ wget https://github.com/alexbel/conky/archive/master.zip

$ unzip master.zip

 

 

Change current working directory to just extracted directory.

$ cd conky-master

 

 

Rename the secrets.yml.example to secrets.yml.

$ mv secrets.yml.example secrets.yml

 

Install Ruby before you could run this (ruby) script.

$ sudo yum install ruby

$ ruby starter.rb

 

Note: This script can be modified to show your current weather, temperature, etc.

If you want to start conky at boot, add the below one liner to startup Applications.

conky –pause 10
save and exit.

 

And Finally…such a lightweight and useful GUI eye candy like package is not in active stage and is not maintained officially anymore. The last stable release was conky 1.9.0 released on May 03, 2012. A thread on Ubuntu forum has gone over 2k pages of users sharing configuration. (link to forum : http://ubuntuforums.org/showthread.php?t=281865/)

 

That’s all for now. Keep connected. Keep commenting. Share your thoughts and configuration in comments below.

 

 

Scientific Linux 2017
Instale conversor de video Winff

$ sudo yum install winff

.

Scientific Linux 2017
Instale Java

$ sudo yum install java

 

 

 

Scientific Linux 2017
Faça update do Grub

$ sudo grub2-mkconfig –output=/boot/grub2/grub.cfg

 

 

 

Scientific Linux 2017
Configure Firewalld

 

verifique se o firewall está ativo

$ systemctl status firewalld

 

Caso não esteja ativo:

 

$ firewall-cmd –set-default-zone=public

$ systemctl enable firewalld

$ systemctl start firewalld

$ firewall-cmd –state

 

 

 

Scientific Linux 2017
Instale 7-zip, Rar, Unrar

$ sudo yum install p7zip rar unrar

 

 

Scientific Linux 2017
Instale VirtualBox

 

$ sudo yum groupinstall ‘Development Tools’ SDL kernel-devel kernel-headers dkms

 

$ sudo wget -q http://download.virtualbox.org/virtualbox/debian/oracle_vbox.asc

 

$ sudo rpm –import oracle_vbox.asc

 

$ sudo yum update && yum install virtualbox-4.3

 

$ sudo wget http://download.virtualbox.org/virtualbox/4.3.12/Oracle_VM_VirtualBox_Extension_Pack-4.3.12-93733.vbox-extpack

 

$ sudo VBoxManage extpack install Oracle_VM_VirtualBox_Extension_Pack-4.3.12-93733.vbox-extpack

 

 

Create a user ‘vbox‘ to manage virtualbox and add it to group vboxusers.

 

$ sudo adduser vbox

$ sudo passwd vobx

$ sudo usermod -G vboxusers vbox

 

Pronto.

 

 

Scientific Linux 2017
Caso queira mais do VirtualBox…

 

Install HTTPD server.

$ sudo yum install httpd

Install PHP (with soap extension).

$ sudo yum install php php-devel php-common php-soap php-gd

Download PHP virtualBox.

$ sudo wget http://sourceforge.net/projects/phpvirtualbox/files/phpvirtualbox-4.3-1.zip

 

Extract the zip and copy the extracted folder to HTTP working directory.

$ sudo unzip phpvirtualbox-4.*.zip

$ sudo cp phpvirtualbox-4.3-1 -R /var/www/html

Next, rename file /var/www/html/phpvirtualbox/config.php-example to var/www/html/phpvirtualbox/config.php.

$ sudo mv config.php.example config.php

Open the configuration file to edit and add ‘username‘ and ‘password‘ we just created in the above step.

$ sudo vi config.php

 

Finally, restart VirtualBox and HTTP server.

$ sudo service vbox-service restart

$ sudo service httpd restart

 

Now forward the port and access it on a headed server.

http://192.168.0.15/phpvirtualbox-4.3-1/

PHP Virtualbox Login

PHP Virtualbox Login
PHP Virtualbox Dashboard

PHP Virtualbox Dashboard

 

 

Scientific Linux 2017
Instale Vsftpd FTP Server – É um dos servidores FTP mais seguros e eficientes disponíveis atualmente.

$ sudo yum install vsftpd

 

Para deixa-lo seguro edite o arquivo de configuração em /etc/vsftpd/vsftpd.conf

$ sudo gedit /etc/vsftpd/vsftpd.conf

 

Encontre e altere as seguintes linhas para que fiquem como está abaixo:

anonymous_enable=NO

local_enable=YES

write_enable=YES

chroot_local_user=YES

 

Talvez, queira alterar portas do firewall

$ sudo firewall-cmd –add-port=21/tcp

$ sudo firewall-cmd –reload

 

Reinicie a máquina e execute

$ sudo systemctl restart vsftpd

$ sudo systemctl enable vsftpd

 

 

Scientific Linux 2017
Instale Rkhunter Pwgen Keepass

$ sudo yum install rkhunter pwgen keepass

 

Uso do Rkhunter

rkhunter {–check | –unlock | –update | –versioncheck |

Então:

$ sudo rkhunter –check | –unlock | –update | –versioncheck

 

 

 

Scientific Linux 2017
Verifique a velocidade da tua internet instalando Speedtest-CLI

$ sudo yum install python-pip speedtest-cli ; pip install –upgrade pip ; sudo pip install speedtest-cli –upgrade

 

Testando a velocidade da internet

$ speedtest

 

Verificando em bytes

$ speedtest –bytes

 

Mostre a todos a velocidade de sua internet

$ speedtest –share

 

Veja a velocidade de download e upload

$ speedtest –simple

 

Velocidade baseada em distância

$ speedtest –list

 

 

 

Scientific Linux 2017 – Games – Scientific Linux 2017 – Games
Agora para finalizar este belo tutorial vamos instalr alguns jogos (atenção é bastante download muitos jogos legais)

$ sudo yum install steam pychess gnome-chess kollision dreamchess xboard gnu-chess kapman pacman gweled chromium-bsu frozen-bubble.x86_64 bomber ; sudo yum update ; sudo yum install texlive-fancybox.noarch pygame.x86_64 plib.x86_64 mumble-overlay.x86_64 libkmahjongg.x86_64 aisleriot.x86_64 opengl-games-utils.noarch gnome-games-help.noarch gnome-games-extra.x86_64 gnome-games-debuginfo.x86_64 gnome-games.x86_64 ; sudo yum update ; sudo yum install tremulous.x86_64 urbanterror.x86_64 worldofpadman.x86_64 openarena.noarch darkplaces-quake.x86_64 ; sudo yum -y distribution-synchronization ; sudo yum -y update ; sudo yum -y upgrade ; sudo yum -y update-minimal

 

Fique de olho no terminal e vá confirmando com s ou y.

 

Bom chegamos ao fim deste Artigo tutorial pós instalação. Na verdade se você aprender tudo que existe neste artigo, na minha opinião, será um usuário avançado ou totalmente independente. A lógida das Distribuições Linux é bem parecida, então daqui para frente, tudo será mais fácil e você poderá experimentar todas que desejar. Não existe sistema Linux melhor que o outro e sim, existe um sistema dentre todos os outros que será o mais adequado para ti, você seguindo por estes caminhos descobrirá qual é a tua distribuição e creio que realizará coisas divertidas e produtivas.

.

 

Mantenha-se conectado, Comente a respeito deste artigo divida seus pensamentos e configurações nos comentários ok? Isto é importante pra mim.

 

🙂

 

.

 

######

 

Scientific Linux 2017 (daqui para baixo eu não testei)

Para avançados ou entediados, tem tudo isto abaixo para brincar:

 

Scientific Linux 2017
Writing the .iso file to a DVD:
The best way to write the .iso file you download is the command line. As root, you can use this command:

$ su

# growisofs -dvd-compat -Z /dev/dvd=YOURISOFILE.iso

 

Scientific Linux 2017
Adding repositories:
The default software repositories that get installed with Scientific Linux are usually not enough for the range of necessary software, so these two repositories can be helpful, type in the following commands as root:
ELRepo:

# rpm –import http://elrepo.org/RPM-GPG-KEY-elrepo.org

# rpm -Uvh http://elrepo.org/elrepo-release-6-5.el6.elrepo.noarch.rpm

EPEL:

Download the rpm

http://fedoraproject.org/wiki/EPEL#How_can_I_use_these_extra_packages.3F

.

Scientific Linux 2017
Emacs:
Emacs is a professional text editor very suitable for programming, text markup (like LaTeX and HTML) and only plain text. I strongly suggest that you become fluent in it if you are using any of these tools. I do have to warn that the learning curve is very steep. If you are new to programming or document mark-up, you can ignore emacs for now and stick to gedit (the default editor). But when you gain a good level of proficiency in them, learning emacs will really simplify your life ;-).
You can install it from the repositories. If you want to install the latest version you will need the following packages. After installing them simply run $ configure –with-x-toolkit=no, $ make and $ make install in the downloaded file. You don’t necessarily need all these packages, but you will have them if necessary.

$ su
$ yum install libgif-devel libungif-devel libtiff-devel libXpm-devel glib libjpeg-devel libpng-devel libtiff-devel ncurses-devel ImageMagick gpm dbus-devel gtk2-devel

.

Scientific Linux 2017
Dropbox:

Dropbox is a very convenient service for syncing your files over several computers. If you don’t already have an account, you can register here. To install Dropbox simply go to the webpage and download it (for Fedora if you are using RHEL or SL). Run the .rpm file and it will be added in “Applications/Internet” menu. By clicking on it it will guide you through the installation. But the main problem is the Dropbox repository address which will interfere with your yum installs and updates later, that you have to edit manually in the command line:

$ su
# gedit /etc/yum.repos.d/dropbox.repo
look for the line that says: baseurl=http://linux.dropbox.com/fedora/$releasever/, comment it out (add # before the line). Add a new line with the following: baseurl=http://linux.dropbox.com/fedora/19/. Save it and close gedit.
Increase the 20, save the file and run # yum update, if it works keep the increased value, if not, use 20. Dropbox is not always in line with the new Fedora releases!

Note that as Dropbox gets updated, it might re-write this file. So later on, in any yum session, if you see it complain about the same problem, you can fix it in the same manner.

.

Scientific Linux 2017
Printer:

To install the printer follow these steps:
Type “localhost:631/” in the browser.

Go to the “Administration” tab and click “Add printer”.

Write “root” as user name and your root password as its password.

Choose the “ipp” type.

The connection should be: socket://IP:9100 for most printers. Needless to say that IP should be the IP address of your printer.

You will need your printer’s PPD file in most cases. The rest is easy and doesn’t need explanations.

 

.

 

Scientific Linux 2017
Adobe Flash

 

There is a very nice explanation Here. You can consider this as a fast summary:

Download and run the YUM version.

This will add a repository file in your /etc/yum.repos.d/ directory so that yum can recognize it.

As root in the command line type:

# yum install flash-plugin for 64bit systems or

# yum install nspluginwrapper alsa-plugins-pulseaudio flash-plugin for 32bit ones.

 

.

Scientific Linux 2017
Adobe PDF viewer

With a fresh linux install you get the Evince PDF viewer. But it is a very simple viewer, in case you want higher quality prints, especially on vector graphic generated plots, and more options, you can install the Adobe PDF viewer. I personally use LaTeX’s pgfplots to draw my plots so all the line and font settings are the same as my text. It also forces me to keep the data that generate the plots beside the text. But the problem was that when I printed it with Evince, the plots would become blurry! Evince would also not show the full resolution (very close vertical lines would be connected). But both these problems were fixed with the adobe PDF viewer. I should caution though that it is a closed source software. If you are producing high quality plots, I strongly recommend it for their printing.
To install it, first you have to become root and install the appropriate Adobe repositories and then install it:

# su
# rpm -ivh http://linuxdownload.adobe.com/adobe-release/adobe-release-i386-1.0-1.noarch.rpm
# rpm –import /etc/pki/rpm-gpg/RPM-GPG-KEY-adobe-linux
# yum install nspluginwrapper.i686 AdobeReader_enu libxml2.so.2
This is only for the English language, in case you want another language you can check the list with yum list AdobeReader* before running the last command. Choose your desired language and change the AdobeReader_enu section of the last line. To run it, simply run acroread. The explanations here on how to install Adobe PDF reader are a summary of the explanations here.
There is one thing I miss in Evince though: Automatic reloading! Unfortunately Adobe PDF viewer doesn’t support that! In order to reload your document you have to either choose “Reload” in the file menu or press Ctrl+R.

.

Scientific Linux 2017
LibreOffice
The installation is very easy: Download a tar ball from here and unpack it. Go to the directory you unpacked it in and:
# su
# cd RPMS
# yum install *.rpm
You are ready to go, easy wasn’t it?
Very soon you will get a notification that a more recent version of LibreOffice is available. If you like to have both versions, it is possible: simply repeat the processes above for the new download. But that will cause your application menus to be bloated. To remove the old version you can use # yum remove libreofficeVERSIONNUMBER* For example if you had LibreOffice 4.1 but have also installed 4.2, you can simply run: # yum remove libreoffice4.1*. If you are not sure about the name of the old version, you can simply run: yum list installed and find the libreoffice package you want to uninstall in that list, then run the yum remove command.

 

.

Scientific Linux 2017
Python 3, NumPy, SciPy and Matplotlib

Python 2.x is usually installed with your system but I use Python 3, since it is the future of Python, not the past ;-). So here is how to install it along with all the other necessary modules:

Download the correct source files package and unpack it.

Run # ./configure, # make and # make install in the unpacked folder.

In order to install pip you will need setuptools. To install it, simply run the command below as root:

# wget https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py -O – | python3
Pip is a very convenient package to install from, you can download from here and install it with:

# python3 setup.py build
# python3 setup.py install

You are going to need the following packages:

# yum install blas blas-devel lapack lapack-devel atlas atlas-devel python-devel

Download NumPy and SciPy. Unpack them and in their unpacked directories run the build and install commands above. Just add a –fcompiler=gnu95 after the build command.
Download Matplotlib (the .tar.gz) and follow the same steps above but without the flagged term (beginning with –). If they don’t work, run chmod +x *.py in the directory first.
Incase you are an astronomer, AstroPy (for working with FITS images) is necessary. But first you will need the Distribute package:

# curl http://python-distribute.org/distribute_setup.py | python3

Then download the source of AstroPy from the “Installing” section and install it same way you installed the above.

To make your personal modules accessible to Python from everywhere, follow these steps:

# cd ~ then # gedit .bashrc Add these two lines to the .bashrc file.

PYTHONPATH=”${PYTHONPATH}:THE ADDRESSES YOU WANT”
export PYTHONPATH

Log out then log in and your modules can be accessed from anywhere.

.

Scientific Linux 2017
SSH and Screen:

SSH and Screen are two very useful methods for remote controlling your operations. With SSH you can login to your computer from any where and with screen you can see how a command is running remotely. So you can begin a command (after both SSH and Screen are activated) that takes a lot of time on your computer in your office, then go home and after a good dinner, see how the command is going. It is truely great. Another appication is that with screen you can log in to you office computer with your smartphone, tablet or computer on the street (or any where), set a command to run and then simply disconnect. The command will run on your computer and you can later check up on it. These two applications have been very useful for me and enabled me to travel across the Pacific with out a laptop, while being able to do all my work from my tablet and smartphone!

Enough of advertisement! You can set up these two by following these steps. First you have to install them (you will probably have the first two packages already!):

# su
# yum install openssh openssh-server screen

 

Then you have to set the sshd daemon only once until the next time you install your operating system (again, these two were probably done automatically by your system right after installation):

# /sbin/chkconfig sshd on
# /sbin/service sshd start

 

Note: In case you have changed your SSH host operating system your “host key” has changed and so you will need to edit the ~/.ssh/known_hosts/ file in your other system (not the one you just changed the operating system of). Open it with any text editor and remove all the line (It is a very long line of un-understandable letters and numbers intertwined!) that starts with your host (the one you just changed the operating system of) IP.

.

Scientific Linux 2017
Reading your CPU status:

If you are an intensive CPU user then this program will really help you track your CPU temperature, fan speeds and everything else related:

 

# su
# yum install lm_sensors
# sensors-detect

 

The last step is to set the program up with your particular system. It will ask a lot of questions! Answer “YES” to all of them and wait until it finishes. Once it is finished, you can get your information by running:

# sensors

 

.

Scientific Linux 2017
Static libraries
If you are writing programs and want to do a static linking between the libraries you are using, you should have the glibc-static package. You can read about the Advantages and disadvantages here:

# yum install glibc-static

 

.

Scientific Linux 2017
Background slideshow:
.

As root copy all the images you want into a directory in /usr/share/backgrounds/. Put a copy of /usr/share/backgrounds/default.xml in that folder, you can call it background-1.xml. This file is a very simple XML file (doesn’t require any knowledge of XML). You will get a hold of how the file works by reading it. Modify it to your desire and save it. Then right click on the desktop background and click “Change Desktop Background” and choose that folder.
With the introduction of GNOME 3, you have to specify the XML file in the Gnome Tweak Tool. You can find it by searching “Tweak Tool” in the activities screen (when you move the mouse to the “hot corner”). Once it opens, in the Desktop tab, you can see a “Picture URI” option, where you can specify a file to set as background. Choose your XML file and your desktop will change. You can also make some other customizations here too.
.
.

 

Scientific Linux 2017
Change Login screen background:

You can change the login screen background to one of the backgrounds you have chosen using the following procedures:
.

For the first time:

 

You first have to find which of the images in /usr/share/backgrounds/ is the login background: it is one of the *_default.png images based on your resolution. Rename each, then go the lock screen to see if the background is removed. In my case it is 1920x1200_default.png, you can rename it to 1920x1200_default_backup.png
Using GIMP, save the image you want as 1920x1200_default.png
As root, move it to /usr/share/backgrounds
.
.

 

Até Breve

 

Espero que este material meu seja útil a você, assim como ele é para mim.

Mantenha-se online e o mais livre possível via pesquisa e estudo.
.
.
Críticas e sugestões são muito bem vindas. Doe da maneira que puder.

 

Scientific-Linux – Sintaxe, Lista de Comandos, Comandos Básicos e Tutorial Pós-Instalação

avatar-gnu-linux

 

Jan – 2017

linux-scientific-images

 

Scientific Linux 7 – Scientific Linux 7

O Scientific Linux 7 deriva do RedHat Enterprise Linux assim como o CentOS o Fedora e outros derivam.

Você pode usar o ScientificLinux assim que acabar de instalar, mas para obter o melhor do sistema é necessário fazer alguns updates e instalar alguns pacotes.
Este artigo, tem como objetivo obter o melhor do sistema e foi testado. Isto não quer dizer, que apesar de ser seguro, nos responsabilizamos por nada relacionado ao uso deste artigo.

O teu computador e teu sistema, são responsabilidade tua.
É hábito sempre antes de iniciar um artigo que ensina a melhorar algum sistema Linux, fornecer a sintaxe, a lista de comandos oferecida pelo sistema, depois um resumo com comandos básicos e só então inicia-se o assunto pós-instalação.
Recomendo que leia tudo até o final e somente depois, execute o tutorial.

O ponto de vista aqui é que você instalou o mínimo possível, ou seja, fez uma instalação netinstall.
Vamos ao artigo. Vai ser o bicho!
–gu1le

Visite:  Toca Scientific-Linux
ScientificLinux – Sintaxe, Lista de comandos, comandos básicos e Tutorial Pós-Instalação.
A sintaxe do comando YUM

# Usual sintaxe para yum #

root@geek [~]# yum [options] [commands] [package name]

# Comandos yum mais populares #

root@geek [~]# [install remove update search info check-update clean repolist list history

# Localização dos arquivos de repositório yum #

root@geek [~]# /etc/yum.repos.d

# Localização do cache do yum #

root@geek [~]# /var/cache/yum

# Remover um único pacote #

root@geek [~]# yum remove httpd

ou

root@geek [~]# yum erase httpd

YUM – Lista de Comandos

Usage: yum [options] COMMAND

Lista de Comandos:

check Procurar por problemas no rpmdb

check-update Verifica por atualizações de pacotes disponíveis

clean Remove os dados do cache

deplist Lista as dependências de um pacote

distribution-synchronization Sincronizar os pacotes instalados para as últimas versões disponíveis

downgrade desatualizando um pacote

erase Remove um ou mais pacotes do seu sistema

fs Creates filesystem snapshots, or lists/deletes current snapshots.

fssnapshot Creates filesystem snapshots, or lists/deletes current snapshots.

groups Display, or use, the groups information

help Exibe uma mensagem de uso para ajuda

history Exibir ou usar o histórico de transações

info Mostra detalhes sobre um pacote ou grupos de pacotes

install Instala um ou mais pacotes no seu sistema

langavailable Check available languages

langinfo List languages information

langinstall Install appropriate language packs for a language

langlist List installed languages

langremove Remove installed language packs for a language

list Lista um pacote ou grupos de pacotes

load-transaction Carregar uma transação salva de um nome de arquivo

makecache Gera o cache de metadados

provides Localiza qual pacote fornece o valor dado

reinstall reinstala um pacote

repo-pkgs Treat a repo. as a group of packages, so we can install/remove all of them

repolist Exibe os repositórios de software configurados

search Pesquisa detalhes do pacote para a string fornecida

shell Executa um shell interativo do yum

swap Simple way to swap packages, instead of using shell

update Atualiza um ou mais pacotes do seu sistema

update-minimal Works like upgrade, but goes to the ‘newest’ package match which fixes a problem that affects your system

updateinfo Acts on repository update information

upgrade Atualiza pacotes levando em conta os obsoletos

version Exibe uma versão para a máquina e/ou os repositórios disponíveis.
Options:

-h, –help mostrar essa mensagem ajuda e sai

-t, –tolerant ser tolerante com os erros

-C, –cacheonly executar por completo a partir do cache do sistema,
não atualiza o cache

-c [config file], –config=[config file]
configurar localização do arquivo

-R [minutes], –randomwait=[minutes]
Tempo máximo de espera do comando

-d [debug level], –debuglevel=[debug level]
nível de depuração na saída

–showduplicates mostrar duplicados em repos e em comandos de
pesquisa/listagem

-e [error level], –errorlevel=[error level]
nível de erro na saída

–rpmverbosity=[debug level name]
nível de depuração na saída para o rpm

-q, –quiet operação discreta

-v, –verbose operação detalhada

-y, –assumeyes responder sim para todas as perguntas

–assumeno answer no for all questions

–version mostrar versão do Yum ao sair

–installroot=[path] definir raiz de instalação

–enablerepo=[repo] habilitar um ou mais repositórios (curingas são
permitidos)

–disablerepo=[repo] desabilitar um ou mais repositórios (curingas são
permitidos)

-x [package], –exclude=[package]
excluir pacote(s) por nome ou glob

–disableexcludes=[repo]
desabilitar a exclusão a partir do principal, para um
repositório ou para tudo

–disableincludes=[repo]
disable includepkgs for a repo or for everything

–obsoletes Habilitar processo de obsolescência durante as
atualizações

–noplugins desabilitar plugins do Yum

–nogpgcheck desabilitar verificação de assinaturas gpg

–disableplugin=[plugin]
desabilitar plugins pelo nome

–enableplugin=[plugin]
habilita plugins pelo nome

–skip-broken ignorar pacotes com problemas de solução de
dependências

–color=COLOR controla o uso da cor

–releasever=RELEASEVER
defina o valor de $releasever nos arquivos repo e yum
config

–downloadonly don’t update, just download

–downloaddir=DLDIR specifies an alternate directory to store packages

–setopt=SETOPTS Configurando opções arbitrárias de repositório e
configurações.

–bugfix Include bugfix relevant packages, in updates

–security Include security relevant packages, in updates

–advisory=ADVS, –advisories=ADVS
Include packages needed to fix the given advisory, in
updates

–bzs=BZS Include packages needed to fix the given BZ, in
updates

–cves=CVES Include packages needed to fix the given CVE, in
updates

–sec-severity=SEVS, –secseverity=SEVS
Include security relevant packages matching the
severity, in updates
###

Scientific Linux 7
YUM – Comandos Básicos

Update

sudo yum update

Upgrade

sudo yum upgrade

Instalar

sudo yum install (nome_do_pacote)

Buscar

sudo yum search (nome, adj, subst)

Procura erros no rpmdb

sudo yum check

Verifica atualização

sudo yum check -update

Lista as dependências de um pacote

sudo yum deplist

Sincroniza os pacotes instalados para as últimas versões disponíveis

sudo yum -y distribution-synchronization

Trabalha como o upgrade , mas vai para os pacotes mais novos possíveis compatíveis que resolvem um problema que afete teu sistema.

sudo yum -y update-minimal

Faz upgrade do sistema

sudo yum -y upgrade

Obs:

Nos comandos acima, o -y é para não ter que dizer sim.
Scientific Linux 7
Comandos uteis:

sudo yum check ; sudo yum check-update ; sudo yum -y distribution-synchronization ; sudo yum -y update ; sudo yum -y update-minimal ; sudo yum -y upgrade
Scientifi-cLinux Pós – Instalação – Scientific-Linux Pós – Instalação

A primeira coisa é proteger o sistema atualizando-o. Faça update e upgrade (obrigatório). Faça isto pelo menos a cada 7 dias. Sem isto com o passar do tempo, seu sistema fica vulnerável e instável.

Abra o terminal com clique direito do mouse

$ sudo yum -y distribution-synchronization ; sudo yum -y update ; sudo yum -y upgrade ; sudo yum -y update-minimal
Pode-se executar comandos com não administrador e como administrador. O simbolo no terminal para não administrador é $ e o simbolo para administrador é # .

No modo administrador não se usa o prefixo sudo e no modo não administrador usa-se o prefixo sudo.
Exemplo abaixo:

Administrador

digite no terminal:

$ su

digite tua senha.

<enter>

# yum install (nome_do_programa)
Não administrador

$ sudo yum install (nome_do_programa)

digite a tua senha

<enter>

confirme a instalção com Y ou S depende da linguagem escolhida.

Aguarde o programa ser instalado.

O modo administrador é apenas para fazer alterações no sistema, navegar em modo administrador expõe o usuário a todos os perigos da internet, usar sudo em modo administrador pode danificar o sistema.

 

Scientific Linux 7
Multimidia, codecs, MP3 & DvD
$ sudo yum install gstreamer gstreamer-plugins-base gstreamer-plugins-good gstreamer-plugins-bad-free ; sudo yum install gstreamer-plugins-bad gstreamer-plugins-ugly gstreamer-ffmpeg ; sudo yum install mplayer mplayer-gui ; sudo yum install libdvdnav libdvdplay lsdvd ; sudo rpm -Uvh http://rpm.livna.org/livna-release.rpm ; sudo yum install vlc ; sudo yum install dragon.x86_64 libmtp.x86_64 totem.x86_64

 

Scientific Linux 7
Instalando VLC

O VLC depende da instalação de repositórios. O Epel e o Nux Dextop. Use os Links abaixo:
$ sudo rpm -Uvh https://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-8.noarch.rpm
$ sudo rpm -Uvh http://li.nux.ro/download/nux/dextop/el7/x86_64/nux-dextop-release-0-5.el7.nux.noarch.rpm
Pode agora instalar o VLC

$ sudo yum install vlc
Caso queira, instale o ótimo repositório da comunidade, o Community Enterprise Linux Repository

$ sudo rpm -Uvh http://www.elrepo.org/elrepo-release-7.0-2.el7.elrepo.noarch.rpm
Scientific Linux 7
Instale reconhecimento de sistemas de arquivos para drivers externos Windows NTFS (HD externo)

$ sudo yum install ntfs-3g.x86_64 ntfs-3g-devel.x86_64 ntfsprogs.x86_64 ; sudo yum update ; sudo yum upgrade
Scientific Linux 7
Instale LIVNA

$ sudo rpm -ivh http://rpm.livna.org/livna-release.rpm
Scientific Linux 7
Instalando Chromium

$ sudo yum install chromium
Scientific Linux 7 – Icones e Temas
Instale Numix, Nuvola, Faience, Bluecurve, Mono, Hicolor Adwaita e Mate-Faenza icon-theme
$ sudo yum install numix-icon-theme.noarch numix-icon-theme-circle.noarch nuvola-icon-theme.noarch faience-icon-theme.noarch bluecurve-icon-theme.noarch adwaita-icon-theme.noarch mate-icon-theme-faenza.noarch hicolor-icon-theme.noarch inx-icon-theme.noarch mono-icon-theme.noarch

 

 

 

Scientific Linux 7

Instale Reprodutores de Música, instale os melhores Players de Música

$ sudo yum install spotify-client.x86_64 rhythmbox.x86_64 quodlibet.noarch exaile.noarch clementine.x86_64 cantata.x86_64 banshee.x86_64

 

 

Arc-Icon-Theme
Scientific Linux 7 – Icones e Temas

Instale o arc-icon-theme
Scientific Linux 7 – Icones e Temas (super-fácil)
Para Instalar Arc-Icon-Theme
$ sudo yum install arc-icon-theme.noarch arc-pine-icon-theme.noarch

 
Scientific Linux 7
Instalando Virtualbox

$ sudo yum install virtualbox
Scientific Linux 7
Instalando Players

$ sudo yum install dragon.x86_64 libmtp.x86_64 totem.x86_64
Scientific Linux 7
Instale Cliente de e-mail Thunderbird (gerenciador de e-mail)

$ sudo yum install thunderbird

 

Scientific Linux 7
Instale navegadores de terminal e youtube-dl

$ sudo yum install youtube-dl elinks links w3m

 

 

Scientific Linux 7
Instale deluge, gimp, mplayer, qbittorrent, smplayer, uget

$ sudo yum install deluge gimp mplayer qbittorrent smplayer uget

 

 

Scientific Linux 7
Instale visualisador de PDF, epub reader, Hq reader

$ sudo yum install evince qpdfview fbreader calibre mcomix comix

 

 

Scientific Linux 7
Instale conky-manager
$ sudo yum install lm_sensors-sensord.x86_64 lm_sensors.x86_64 xsensors.x86_64 qt5-qtsensors.x86_64 lm_sensors-libs.x86_64 collectd-sensors.x86_64

$ sudo yum install lm-sensors curl hddtemp sensors-detect

Confirme afirmativamente todas as perguntas do terminal.

Agora instale o conky-manager o repositório EPEL já deve estar instalado antes de fazer isto.

$ sudo yum install conky-manager
E pronto você ira ter o conky-manager em seu desktop, é só procurar em acessórios.

Mas pode-se fazer melhor com o conky. Você pode ter uma linda e harmoniosa área de trabalho com ele.

Caso queira tentar prossiga abaixo.
Verifique todos os sensores detectados com o comando abaixo.

$ sudo sensors

Exemplo do que irá aparecer:

$ sudo sensors

acpitz-virtual-0
Adapter: Virtual device
temp1: +44.0°C (crit = +104.0°C)
temp2: +44.0°C (crit = +104.0°C)

coretemp-isa-0000
Adapter: ISA adapter
Physical id 0: +44.0°C (high = +105.0°C, crit = +105.0°C)
Core 0: +43.0°C (high = +105.0°C, crit = +105.0°C)
Caso queira integrar o conky ao seu Desktop e isto é muito útil, primeira saiba que a configuração básica do conky está em /etc/conky/conky.conf então copie este arquivo para a pasta Home e renomeie-a como .conkyrc o ponto no início manterá este arquivo escondido.
$ cp /etc/conky/conky.conf /home/$USER/.conkyrc

Reinicie o conky para efetuar novas mudanças.

$ killall -SIGUSR1 conky

Você pode editar as configurações do conky no arquivo que está na pasta Home é bem fácil de entender.

Você pode usar scripts diferentes do conky básico. Você pode escrever seu próprio script conky ou pode usar um dos muitos scripts para conky da internet. Não use qualquer script que encontre. Abaixo dois links confiáveis de scripts conky.
http://ubuntuforums.org/showthread.php?t=281865

http://conky.sourceforge.net/screenshots.html
Você verá que cada captura possui um Hiperlink que irá te redirecionar ao arquivo script conky.
Testando um script conky

$ wget https://github.com/alexbel/conky/archive/master.zip

$ unzip master.zip
Change current working directory to just extracted directory.

$ cd conky-master
Rename the secrets.yml.example to secrets.yml.

$ mv secrets.yml.example secrets.yml

Install Ruby before you could run this (ruby) script.

$ sudo yum install ruby

$ ruby starter.rb

Note: This script can be modified to show your current weather, temperature, etc.

If you want to start conky at boot, add the below one liner to startup Applications.

conky –pause 10
save and exit.

And Finally…such a lightweight and useful GUI eye candy like package is not in active stage and is not maintained officially anymore. The last stable release was conky 1.9.0 released on May 03, 2012. A thread on Ubuntu forum has gone over 2k pages of users sharing configuration. (link to forum : http://ubuntuforums.org/showthread.php?t=281865/)
Conky Homepage

That’s all for now. Keep connected. Keep commenting. Share your thoughts and configuration in comments below.

 

Scientific Linux 7
Instale conversor de video Winff

$ sudo yum install winff
Scientific Linux 7
Instale Java

$ sudo yum install java
Scientific Linux 7
Faça update do Grub

$ sudo grub2-mkconfig –output=/boot/grub2/grub.cfg
Scientific Linux 7
Configure Firewalld
verifique se o firewall está ativo

$ systemctl status firewalld

Caso não esteja ativo:
$ firewall-cmd –set-default-zone=public

$ systemctl enable firewalld

$ systemctl start firewalld

$ firewall-cmd –state

Scientific Linux 7
Instale 7-zip, Rar, Unrar

$ sudo yum install p7zip rar unrar

 

Scientific Linux 7
Instale VirtualBox

$ sudo yum groupinstall ‘Development Tools’ SDL kernel-devel kernel-headers dkms

$ sudo wget -q http://download.virtualbox.org/virtualbox/debian/oracle_vbox.asc

$ sudo rpm –import oracle_vbox.asc

$ sudo yum update && yum install virtualbox-4.3

$ sudo wget http://download.virtualbox.org/virtualbox/4.3.12/Oracle_VM_VirtualBox_Extension_Pack-4.3.12-93733.vbox-extpack

$ sudo VBoxManage extpack install Oracle_VM_VirtualBox_Extension_Pack-4.3.12-93733.vbox-extpack

Create a user ‘vbox‘ to manage virtualbox and add it to group vboxusers.

$ sudo adduser vbox

$ sudo passwd vobx

$ sudo usermod -G vboxusers vbox
Pronto.

 

 

Scientific Linux 7
Caso queira mais do VirtualBox…
Install HTTPD server.

$ sudo yum install httpd

Install PHP (with soap extension).

$ sudo yum install php php-devel php-common php-soap php-gd

Download PHP virtualBox.

$ sudo wget http://sourceforge.net/projects/phpvirtualbox/files/phpvirtualbox-4.3-1.zip

Extract the zip and copy the extracted folder to HTTP working directory.

$ sudo unzip phpvirtualbox-4.*.zip

$ sudo cp phpvirtualbox-4.3-1 -R /var/www/html

Next, rename file /var/www/html/phpvirtualbox/config.php-example to var/www/html/phpvirtualbox/config.php.

$ sudo mv config.php.example config.php

Open the configuration file to edit and add ‘username‘ and ‘password‘ we just created in the above step.

$ sudo vi config.php

Finally, restart VirtualBox and HTTP server.

$ sudo service vbox-service restart

$ sudo service httpd restart

Now forward the port and access it on a headed server.

http://192.168.0.15/phpvirtualbox-4.3-1/

PHP Virtualbox Login

PHP Virtualbox Login
PHP Virtualbox Dashboard

PHP Virtualbox Dashboard

 

 

Scientific Linux 7
Instale Vsftpd FTP Server – É um dos servidores FTP mais seguros e eficientes disponíveis atualmente.

$ sudo yum install vsftpd
Para deixa-lo seguro edite o arquivo de configuração em /etc/vsftpd/vsftpd.conf

$ sudo gedit /etc/vsftpd/vsftpd.conf
Encontre e altere as seguintes linhas para que fiquem como está abaixo:

anonymous_enable=NO

local_enable=YES

write_enable=YES

chroot_local_user=YES

Talvez, queira alterar portas do firewall

$ sudo firewall-cmd –add-port=21/tcp

$ sudo firewall-cmd –reload

Reinicie a máquina e execute

$ sudo systemctl restart vsftpd

$ sudo systemctl enable vsftpd
Scientific Linux 7
Instale Rkhunter Pwgen Keepass

$ sudo yum install rkhunter pwgen keepass
Uso do Rkhunter

rkhunter {–check | –unlock | –update | –versioncheck |

Então:

$ sudo rkhunter –check | –unlock | –update | –versioncheck

 

 

Scientific Linux 7
Verifique a velocidade da tua internet instalando Speedtest-CLI

$ sudo yum install python-pip speedtest-cli ; pip install –upgrade pip ; sudo pip install speedtest-cli –upgrade
Testando a velocidade da internet

$ speedtest
Verificando em bytes

$ speedtest –bytes
Mostre a todos a velocidade de sua internet

$ speedtest –share
Veja a velocidade de download e upload

$ speedtest –simple
Velocidade baseada em distância

$ speedtest –list
Scientific Linux 7 – Games – Scientific Linux 7 – Games
Agora para finalizar este belo tutorial vamos instalr alguns jogos (atenção é bastante download muitos jogos legais)

$ sudo yum install steam pychess gnome-chess kollision dreamchess xboard gnu-chess kapman pacman gweled chromium-bsu frozen-bubble.x86_64 bomber ; sudo yum update ; sudo yum install texlive-fancybox.noarch pygame.x86_64 plib.x86_64 mumble-overlay.x86_64 libkmahjongg.x86_64 aisleriot.x86_64 opengl-games-utils.noarch gnome-games-help.noarch gnome-games-extra.x86_64 gnome-games-debuginfo.x86_64 gnome-games.x86_64 ; sudo yum update ; sudo yum install tremulous.x86_64 urbanterror.x86_64 worldofpadman.x86_64 openarena.noarch darkplaces-quake.x86_64 ; sudo yum -y distribution-synchronization ; sudo yum -y update ; sudo yum -y upgrade ; sudo yum -y update-minimal
Fique de olho no terminal e vá confirmando com s ou y.
Bom chegamos ao fim deste Artigo tutorial pós instalação. Na verdade se você aprender tudo que existe neste artigo, na minha opinião, será um usuário avançado ou totalmente independente. A lógida das Distribuições Linux é bem parecida, então daqui para frente, tudo será mais fácil e você poderá experimentar todas que desejar. Não existe sistema Linux melhor que o outro e sim, existe um sistema dentre todos os outros que será o mais adequado para ti, você seguindo por estes caminhos descobrirá qual é a tua distribuição e creio que realizará coisas divertidas e produtivas.

 

Por enquanto é isto. Mantenha-se conectado, Comente a respeito deste artigo divida seus pensamentos e configurações nos comentários. Isto é importante pra mim.

 

Boa sorte e um abraço do gu1le.

 

🙂

 

 

 

######

 

 

Scientific Linux 7 (daqui para baixo eu não testei)

Para avançados ou entediados, tem tudo isto abaixo para brincar:

Scientific Linux 7
Writing the .iso file to a DVD:
The best way to write the .iso file you download is the command line. As root, you can use this command:

$ su

# growisofs -dvd-compat -Z /dev/dvd=YOURISOFILE.iso
Scientific Linux 7
Adding repositories:
The default software repositories that get installed with Scientific Linux are usually not enough for the range of necessary software, so these two repositories can be helpful, type in the following commands as root:
ELRepo:

# rpm –import http://elrepo.org/RPM-GPG-KEY-elrepo.org

# rpm -Uvh http://elrepo.org/elrepo-release-6-5.el6.elrepo.noarch.rpm

EPEL:

Download the rpm

http://fedoraproject.org/wiki/EPEL#How_can_I_use_these_extra_packages.3F

Scientific Linux 7
Emacs:
Emacs is a professional text editor very suitable for programming, text markup (like LaTeX and HTML) and only plain text. I strongly suggest that you become fluent in it if you are using any of these tools. I do have to warn that the learning curve is very steep. If you are new to programming or document mark-up, you can ignore emacs for now and stick to gedit (the default editor). But when you gain a good level of proficiency in them, learning emacs will really simplify your life ;-).
You can install it from the repositories. If you want to install the latest version you will need the following packages. After installing them simply run $ configure –with-x-toolkit=no, $ make and $ make install in the downloaded file. You don’t necessarily need all these packages, but you will have them if necessary.

$ su
$ yum install libgif-devel libungif-devel libtiff-devel libXpm-devel glib libjpeg-devel libpng-devel libtiff-devel ncurses-devel ImageMagick gpm dbus-devel gtk2-devel

Scientific Linux 7
Dropbox:

Dropbox is a very convenient service for syncing your files over several computers. If you don’t already have an account, you can register here. To install Dropbox simply go to the webpage and download it (for Fedora if you are using RHEL or SL). Run the .rpm file and it will be added in “Applications/Internet” menu. By clicking on it it will guide you through the installation. But the main problem is the Dropbox repository address which will interfere with your yum installs and updates later, that you have to edit manually in the command line:

$ su
# gedit /etc/yum.repos.d/dropbox.repo
look for the line that says: baseurl=http://linux.dropbox.com/fedora/$releasever/, comment it out (add # before the line). Add a new line with the following: baseurl=http://linux.dropbox.com/fedora/19/. Save it and close gedit.
Increase the 20, save the file and run # yum update, if it works keep the increased value, if not, use 20. Dropbox is not always in line with the new Fedora releases!

Note that as Dropbox gets updated, it might re-write this file. So later on, in any yum session, if you see it complain about the same problem, you can fix it in the same manner.

Scientific Linux 7
Printer:

To install the printer follow these steps:
Type “localhost:631/” in the browser.

Go to the “Administration” tab and click “Add printer”.

Write “root” as user name and your root password as its password.

Choose the “ipp” type.

The connection should be: socket://IP:9100 for most printers. Needless to say that IP should be the IP address of your printer.

You will need your printer’s PPD file in most cases. The rest is easy and doesn’t need explanations.

Scientific Linux 7
Adobe Flash
There is a very nice explanation Here. You can consider this as a fast summary:

Download and run the YUM version.

This will add a repository file in your /etc/yum.repos.d/ directory so that yum can recognize it.

As root in the command line type:

# yum install flash-plugin for 64bit systems or

# yum install nspluginwrapper alsa-plugins-pulseaudio flash-plugin for 32bit ones.
Scientific Linux 7
Adobe PDF viewer

With a fresh linux install you get the Evince PDF viewer. But it is a very simple viewer, in case you want higher quality prints, especially on vector graphic generated plots, and more options, you can install the Adobe PDF viewer. I personally use LaTeX’s pgfplots to draw my plots so all the line and font settings are the same as my text. It also forces me to keep the data that generate the plots beside the text. But the problem was that when I printed it with Evince, the plots would become blurry! Evince would also not show the full resolution (very close vertical lines would be connected). But both these problems were fixed with the adobe PDF viewer. I should caution though that it is a closed source software. If you are producing high quality plots, I strongly recommend it for their printing.
To install it, first you have to become root and install the appropriate Adobe repositories and then install it:

# su
# rpm -ivh http://linuxdownload.adobe.com/adobe-release/adobe-release-i386-1.0-1.noarch.rpm
# rpm –import /etc/pki/rpm-gpg/RPM-GPG-KEY-adobe-linux
# yum install nspluginwrapper.i686 AdobeReader_enu libxml2.so.2
This is only for the English language, in case you want another language you can check the list with yum list AdobeReader* before running the last command. Choose your desired language and change the AdobeReader_enu section of the last line. To run it, simply run acroread. The explanations here on how to install Adobe PDF reader are a summary of the explanations here.
There is one thing I miss in Evince though: Automatic reloading! Unfortunately Adobe PDF viewer doesn’t support that! In order to reload your document you have to either choose “Reload” in the file menu or press Ctrl+R.

Scientific Linux 7
LibreOffice
The installation is very easy: Download a tar ball from here and unpack it. Go to the directory you unpacked it in and:
# su
# cd RPMS
# yum install *.rpm
You are ready to go, easy wasn’t it?
Very soon you will get a notification that a more recent version of LibreOffice is available. If you like to have both versions, it is possible: simply repeat the processes above for the new download. But that will cause your application menus to be bloated. To remove the old version you can use # yum remove libreofficeVERSIONNUMBER* For example if you had LibreOffice 4.1 but have also installed 4.2, you can simply run: # yum remove libreoffice4.1*. If you are not sure about the name of the old version, you can simply run: yum list installed and find the libreoffice package you want to uninstall in that list, then run the yum remove command.
Scientific Linux 7
Python 3, NumPy, SciPy and Matplotlib

Python 2.x is usually installed with your system but I use Python 3, since it is the future of Python, not the past ;-). So here is how to install it along with all the other necessary modules:

Download the correct source files package and unpack it.

Run # ./configure, # make and # make install in the unpacked folder.

In order to install pip you will need setuptools. To install it, simply run the command below as root:

# wget https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py -O – | python3
Pip is a very convenient package to install from, you can download from here and install it with:

# python3 setup.py build
# python3 setup.py install

You are going to need the following packages:

# yum install blas blas-devel lapack lapack-devel atlas atlas-devel python-devel

Download NumPy and SciPy. Unpack them and in their unpacked directories run the build and install commands above. Just add a –fcompiler=gnu95 after the build command.
Download Matplotlib (the .tar.gz) and follow the same steps above but without the flagged term (beginning with –). If they don’t work, run chmod +x *.py in the directory first.
Incase you are an astronomer, AstroPy (for working with FITS images) is necessary. But first you will need the Distribute package:

# curl http://python-distribute.org/distribute_setup.py | python3

Then download the source of AstroPy from the “Installing” section and install it same way you installed the above.

To make your personal modules accessible to Python from everywhere, follow these steps:

# cd ~ then # gedit .bashrc Add these two lines to the .bashrc file.

PYTHONPATH=”${PYTHONPATH}:THE ADDRESSES YOU WANT”
export PYTHONPATH

Log out then log in and your modules can be accessed from anywhere.
Scientific Linux 7
SSH and Screen:

SSH and Screen are two very useful methods for remote controlling your operations. With SSH you can login to your computer from any where and with screen you can see how a command is running remotely. So you can begin a command (after both SSH and Screen are activated) that takes a lot of time on your computer in your office, then go home and after a good dinner, see how the command is going. It is truely great. Another appication is that with screen you can log in to you office computer with your smartphone, tablet or computer on the street (or any where), set a command to run and then simply disconnect. The command will run on your computer and you can later check up on it. These two applications have been very useful for me and enabled me to travel across the Pacific with out a laptop, while being able to do all my work from my tablet and smartphone!

Enough of advertisement! You can set up these two by following these steps. First you have to install them (you will probably have the first two packages already!):

# su
# yum install openssh openssh-server screen
Then you have to set the sshd daemon only once until the next time you install your operating system (again, these two were probably done automatically by your system right after installation):

# /sbin/chkconfig sshd on
# /sbin/service sshd start
Note: In case you have changed your SSH host operating system your “host key” has changed and so you will need to edit the ~/.ssh/known_hosts/ file in your other system (not the one you just changed the operating system of). Open it with any text editor and remove all the line (It is a very long line of un-understandable letters and numbers intertwined!) that starts with your host (the one you just changed the operating system of) IP.

Scientific Linux 7
Reading your CPU status:

If you are an intensive CPU user then this program will really help you track your CPU temperature, fan speeds and everything else related:
# su
# yum install lm_sensors
# sensors-detect

The last step is to set the program up with your particular system. It will ask a lot of questions! Answer “YES” to all of them and wait until it finishes. Once it is finished, you can get your information by running:

# sensors
Scientific Linux 7
Static libraries
If you are writing programs and want to do a static linking between the libraries you are using, you should have the glibc-static package. You can read about the Advantages and disadvantages here:

# yum install glibc-static
Scientific Linux 7
Background slideshow:

As root copy all the images you want into a directory in /usr/share/backgrounds/. Put a copy of /usr/share/backgrounds/default.xml in that folder, you can call it background-1.xml. This file is a very simple XML file (doesn’t require any knowledge of XML). You will get a hold of how the file works by reading it. Modify it to your desire and save it. Then right click on the desktop background and click “Change Desktop Background” and choose that folder.
With the introduction of GNOME 3, you have to specify the XML file in the Gnome Tweak Tool. You can find it by searching “Tweak Tool” in the activities screen (when you move the mouse to the “hot corner”). Once it opens, in the Desktop tab, you can see a “Picture URI” option, where you can specify a file to set as background. Choose your XML file and your desktop will change. You can also make some other customizations here too.

Scientific Linux 7
Change Login screen background:

You can change the login screen background to one of the backgrounds you have chosen using the following procedures:

For the first time:
You first have to find which of the images in /usr/share/backgrounds/ is the login background: it is one of the *_default.png images based on your resolution. Rename each, then go the lock screen to see if the background is removed. In my case it is 1920x1200_default.png, you can rename it to 1920x1200_default_backup.png
Using GIMP, save the image you want as 1920x1200_default.png
As root, move it to /usr/share/backgrounds
Para saber mais visite:

Toca Scientific-Linux

http://www.2daygeek.com/yum-command-examples/

http://www.scoop.it/t/install-phpmyadmin-in-centos-7/p/4063986301/2016/05/18/install-enable-elrepo-on-rhel-centos-scientific-linux-2daygeek

https://aur.archlinux.org/packages/gtk-theme-arc-git/?comments=all

https://github.com/horst3180/arc-icon-theme

http://www.noobslab.com/2016/06/arc-theme-light-dark-versions-and-icons.html
fonte do texto em ingles:

http://astr.tohoku.ac.jp/~akhlaghi/newlinux.html

30 Things to Do After Minimal RHEL/CentOS 7 Installation


.