Basic Linux komennot Linux ja Windows-käyttöjärjestelmissä
Tämä kirjoitus on hyödyllinen niille, jotka haluavat päästä alkuun Linuxin komentoja. Täältä löydät yleisimmät komennot, joita käytetään Linux.
Jos haluat käyttää Linuxia komennot Windows asenna Cygwin. Cygwin is a Linux layer on top of Windows that allows you to use Linux commands in Windows.
Jos asennat Cygwin Windows sitten oletuspolku kun käynnistät Cygwin terminaali on:
C:\cygwin64\home\{username}
Luo uusi muistilehtiö tiedosto esimerkki
touch textfile.txt
Vaihda hakemisto
cd {directory path\name}
List directory content in long format ( -l ) including hidden files and directories ( -a )
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
Näytä nykyinen sijainti (print working directory)
pwd
Pura viimeksi 100 sanat tiedosto
tail -100 {filename.extension}
Purkaa ensimmäistä 100 riviä tiedoston
head -100 {filename.extension}
Kopioi tiedosto
cp {source} {destination}
Siirrä tiedosto
mv {source} {destination}
Tee uusi hakemisto
mkdir {new directory name}
Poista tiedosto
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}
Lajitella tiedoston sisällön
sort {filename to sort}
Poista kahtena merkinnät tiedostoon
uniq {filename to remove duplicates}
Pakata tiedostoja
gzip {filename}
Pakkaa hakemisto
gzip -r {directory name}
Laske rivien ja sanoja tekstitiedosto
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
Näytön sisältö tekstitiedoston
cat
sed stream editor (similar to find and replace)
sed 's/snow/rain/' forests.txt
Muuta tiedostojen ja hakemiston käyttöoikeuksia
chmod {options} {permissions} {filename}
Listaa viime käytetyt komennot
history
Automaattisesti ajoittaa tehtävät
cron
crontab
Muuta tiedoston käyttöoikeuksia
chmod {permission number} {some file or directory}
chmod 777 /storage
Vaihda rekursiivinen tiedoston käyttöoikeuksia
chmod -R {permission number} {some file or directory}
