Learn / Lessons

Linux and Terminal basics

Your DGX Spark runs Linux. A few commands will take you a long way. pwd shows the folder you're in. ls lists what's there. cd moves you into another folder.

Chapters

  1. 0:00Introduction
  2. 0:06Find your way: Where am I?
  3. 0:15Files: Make and copy
  4. 0:22Look: Read files
  5. 0:31Take care: Think before delete
  6. 0:43Check up: How is the machine?
  7. 0:48Stuck?: Ask for help
  8. 0:55From afar: Log in remotely
  9. 1:03Wrap up
Read the transcript

Introduction

Your DGX Spark runs Linux. A few commands will take you a long way.

Find your way: Where am I?

pwd shows the folder you're in. ls lists what's there. cd moves you into another folder.

pwd
ls -la
cd projects

Files: Make and copy

Make a folder with mkdir. Copy files with cp, and move or rename them with mv.

mkdir notes
cp report.txt notes/
mv notes/report.txt notes/old.txt

Look: Read files

Less shows a file a page at a time. Press Q to leave. Tail follows a log as it grows. Grep finds lines that match.

less notes/old.txt
tail -f server.log
grep -i error server.log

Take care: Think before delete

rm deletes, and there's no bin to rescue it from. Read the whole command first. Sudo runs a command with full power. Don't paste commands you don't understand.

Check up: How is the machine?

Check free space, memory, and what's busy.

df -h
free -g
top

Stuck?: Ask for help

Most commands explain themselves. Add --help, or open the manual page.

ls --help
man ls

From afar: Log in remotely

From another computer, use SSH, with your user name and the machine's name. Type exit when you're done.

ssh you@your-spark
hostname
exit

Wrap up

Look first, then act. The terminal gets friendlier fast.

Sources

More lessons