Grundlæggende Linux Kommandoer på Linux og Windows-operativsystemer
Dette skrives er nyttigt for dem, der ønsker at komme i gang med Linux-kommandoer. Here you will find the most common commands that are used in Linux.
Hvis du gerne vil køre linux kommandoer på Windows derefter installere Cygwin. Cygwin is a Linux layer on top of Windows that allows you to use Linux commands in Windows.
Hvis du installerer Cygwin på Windows derefter standard sti, når du starter Cygwin terminal vil være:
C:\cygwin64\home\{username}
Opret ny notesblok fil eksempel
touch textfile.txt
Skift mappe
cd {directory path\name}
List directory content in long format ( -l ) including hidden files and directories ( --en )
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
Vis nuværende placering (print working directory)
pwd
Uddrag sidste 100 ordene fra en fil
tail -100 {filename.extension}
Uddrag først 100 rækker af en fil
head -100 {filename.extension}
Kopiere en fil
cp {source} {destination}
Flyt en fil
mv {source} {destination}
Lav en ny mappe
mkdir {new directory name}
Slet fil
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}
Sortere indholdet af en fil
sort {filename to sort}
Fjern dubletter i en fil
uniq {filename to remove duplicates}
Komprimere filer
gzip {filename}
Komprimer mappen
gzip -r {directory name}
Tæl antallet af rækker og ord i en tekstfil
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
Vis indholdet i en tekstfil
cat
sed stream editor (similar to find and replace)
sed 's/snow/rain/' forests.txt
Ændre filrettigheder og bibliotek
chmod {options} {permissions} {filename}
Liste seneste kommandoer, der bruges
history
Planlægge opgaver automatisk
cron
crontab
Tilladelser Skift fil
chmod {permission number} {some file or directory}
chmod 777 /storage
Ændre tilladelser rekursive fil
chmod -R {permission number} {some file or directory}
