Linux Básico Ordes en Linux e sistemas operativos Windows

This writing is useful for those that wish to get started with Linux commands. Here you will find the most common commands that are used in Linux.

If you would like to run Linux commands on Windows then install Cygwin. Cygwin is a Linux layer on top of Windows that allows you to use Linux commands in Windows.

Se instalar Cygwin en Windows, a continuación, o camiño estándar cando se inicia o terminal Cygwin será:

C:\cygwin64\home\{username}

 

Crear novo exemplo de arquivo de bloque de notas

touch textfile.txt

 

Cambia o directorio

cd {directory path\name}

 

List directory content in long format ( -l ) including hidden files and directories ( -un )

ls -l -a

ls -al

 

Order files and directories by the time they were last modified

ls -t

 

List directory with pause and scrolling

ls -l | less

 

Amosar a localización actual (print working directory)

pwd

 

Extraia última 100 palabras dun ficheiro

tail -100 {filename.extension}

 

Extraia primeiro 100 liñas dun ficheiro

head -100 {filename.extension}

 

Copiar un ficheiro

cp {source} {destination}

 

Mover un ficheiro

mv {source} {destination}

 

Crea un novo directorio

mkdir {new directory name}

 

Eliminar arquivo

rm {filename}

 

Delete an empty directory

rmdir {directory to remove}
rm -d{directory to remove}

 

Delete directory and its contents

rm -r {directory to remove}
rm -R{directory to remove}

 

Clasificar o contido dun ficheiro

sort {filename to sort}

 

Eliminar entradas duplicadas nun ficheiro

uniq {filename to remove duplicates}

 

Compactar ficheiros

gzip {filename}

 

Comprimir directorio

gzip -r {directory name}

 

Contar o número de liñas e palabras nun arquivo de texto

wc {filename}

 

Search text within files for matching string pattern (case sensitive)

grep 'word' {filename}

 

Search text within files for matching string pattern (case insensitive)

grep -i 'word' {filename}

 

Search with a directory

grep -R Arctic /home/ccuser/workspace/geography

 

Mostrar o contido dun ficheiro de texto

cat

 

sed stream editor (similar to find and replace)

sed 's/snow/rain/' forests.txt

 

Cambiar os permisos de arquivos e directorios

chmod {options} {permissions} {filename}

 

Liste os comandos recentes usados

history

 

Axenda tarefas automaticamente

cron
crontab

 

Cambiar os permisos de ficheiro

chmod {permission number} {some file or directory}
chmod 777 /storage

 

Cambiar os permisos de arquivos recursiva

chmod -R {permission number} {some file or directory}

 

 

Deixar unha resposta