noFlightSchool

Getting Started with UNIX

UNIX is built around a simple yet powerful design philosophy: “Everything is a file.” This allows UNIX to be highly adaptable across different computing environments.

Basic UNIX Commands

Command Description
lsLists files in a directory
cdChanges directory
mkdirCreates a new directory
rmDeletes a file or directory
cpCopies files
mvMoves or renames files
chmodChanges file permissions
grepSearches text within files
psDisplays active processes
killTerminates a process

UNIX File System & Navigation

The UNIX file structure is hierarchical, starting from the root directory /. Learn how to navigate and manage files efficiently.

Key Directories in UNIX:

Editing Text Files

UNIX provides several powerful tools to edit text files directly from the terminal. Here are the most commonly used editors:

1. nano (Beginner-Friendly)

nano is a straightforward text editor ideal for beginners. It displays commands at the bottom of the screen and is easy to use.

Example: nano myfile.txt

Use Ctrl + O to save and Ctrl + X to exit.

2. vi or vim (Advanced)

vi is a powerful editor built into most UNIX systems. vim is an improved version with extended features. These editors have two modes: normal mode and insert mode.

Example: vi myfile.txt

3. cat and echo (Quick Edits)

For very small edits, cat and echo can be used to create or append to files directly.

Create a file: echo "Hello, UNIX!" > hello.txt

Append to a file: echo "Another line" >> hello.txt

View a file: cat hello.txt

Each tool has its strengths — start with nano and gradually explore vim as you become more comfortable with UNIX.