Linux Commands Flashcards
cat filename
prints contents of file to screen
grep searchterm filename
search file for search term
sort filename
sort file alphabetically
sort -r filename
sort file z-a
uniq filename
removes duplicates that are beside each other
awk ‘{print $1, $2}’ filename
print column 1 and 2 of file
awk ‘{print $1, “eats”, $2}’ filename
prints column 1 and 2 with eats between them
wc filename
counts words in file
wc -l filename
counts number of lines in a file
pwd
prints pathway to folder
ls
prints contents of file your in
cd foldername
move into folder
cd ..
go back a folder
sort file > sorted_file.txt
create new file called sorted_file and save contents there
sort file»_space; sorted_file.txt
add the sorted contents of the file to the end of sorted file
cat file1 file2 > file3
joins file1 and file2 and puts contents into new file called file3
cp file1 file2
copy contents of file1 to file2
mkdir name
make a new folder called name
rm file
remove file
*
means all files in same directory
rm*
removes all files
ls*
lists all files
ls temp*
lists all files starting with temp
sort -n file
sort file in numerical order
uniq -c
tells you how many times a line repeated