Linux Command Lab

ls

directory listing (list all files/folders on current dir)

Example: ls -la
ls -l

formatted listing

Example: ls -l
ls -la

formatted listing including hidden files

Example: ls -la
cd dir

change directory to dir (dir will become directory name)

Example: cd Documents
cd..

change to parent directory

Example: cd..
cd

change to home directory

Example: cd
pwd

show current directory

Example: pwd
mkdir dir

create a directory dir

Example: mkdir myproject
rm file

delete file

Example: rm document.txt
rm -f dir

force remove file

Example: rm -f oldfile.txt
rm -r dir

delete directory dir

Example: rm -r myfolder
cp file1 file2

copy file1 to file2

Example: cp backup.txt backup2.txt
mv file1 file2

rename file1 to file2

Example: mv oldname.txt newname.txt
touch file

create or update file

Example: touch newfile.txt
cat file

output contents of file

Example: cat readme.txt
cat > file

write standard input into file

Example: cat > newfile.txt
tail -f file

output contents of file as it grows

Example: tail -f logfile.txt

Interactive Terminal

$ Welcome to Linux Command Lab - Interactive Terminal
$ Type commands or click "Try It" buttons to execute
$ Current directory: /home/user
 
/home/user $