Mastering Ubuntu Server: Essential Terminal Commands and File Management

Taming the Terminal Makes Server Management Easier
Hello.
Last time, we covered installing Ubuntu Server and connecting remotely via SSH.
This session will dive into practical Linux management techniques.
If you're new to Ubuntu, the plain terminal screen might feel unfamiliar at first.
But as you'll discover, most server tasks are performed through the terminal.
While it may seem daunting initially, you'll find that only a few commands are used frequently in daily operations.
In this lesson, we'll focus on the most commonly used commands for easy understanding.
Check Your Current Location
In Windows, you can see your current folder in File Explorer.
In Ubuntu, use this command:
pwd
pwd stands for Print Working Directory.
It displays the full path of your current working folder.
For example, if you see:
/home/ubuntu
this means you're currently working inside the home folder.
View Files and Folders
To see contents of your current folder, use:
ls
For more detailed information:
ls -l
To see hidden files as well:
ls -la
This is one of the most frequently used commands in server management.
Navigate Folders
To move to another folder, use the cd command.
For example:
cd /var/www
will take you to the /var/www directory.
To return to your home folder:
cd
or
cd ~
To move up one folder level:
cd ..
Create Folders
To create a new folder, use mkdir.
For example:
mkdir myproject
creates the myproject folder.
To create multiple nested folders at once:
mkdir -p /var/www/blog/uploads
use the -p option.
Create Files
To create a simple empty file, use touch:
touch index.html
or
touch test.txt
This command is frequently used when testing web servers.
Copy Files
To copy a file, use cp:
cp index.html index_backup.html
To copy an entire folder:
cp -r blog backup_blog
use the -r option.
Move Files and Rename
The mv command can both move files and rename them.
Moving a file:
Rename a file:
For example:
mv test.txt sample.txt
renames the file.
Or to move it to another folder:
mv sample.txt /var/www/html/
Delete Files
To delete a file, use rm:
rm test.txt
To delete a folder and its contents:
rm -r uploads
For forced deletion (use with caution):
rm -rf uploads
The rm -rf command is very powerful and should only be used after confirming the target location.
Deleted files are permanently removed without going to a recycle bin.
View File Contents
To view text file contents, use cat:
cat index.html
For longer files, use less or more for easier navigation:
less index.html
or
more index.html
Using the Nano Editor
Nano is the default text editor in Ubuntu.
To edit a file:
nano index.html
After editing, follow these steps to save and exit:
Ctrl + O → Save
Enter → Confirm
Ctrl + X → Exit
Nano is recommended for beginners learning Linux.
Why Permissions Matter in Linux
Linux prioritizes security, so every file has permissions set for:
Who can read it
Who can modify it
Who can execute it
This contributes to Linux's strong security posture.
Check File Permissions
Use this command to view file permissions:
ls -l
Permissions appear like this:
-rw-r--r--
At first glance, it may seem complex but the logic is straightforward.
Permissions consist of three categories:
r = Read
w = Write
x = Execute
And they apply in this order:
User (owner)
Group
Others
chmod Command
This command changes file permissions.
For example:
chmod 755 index.php
is a common permission setting.
Or:
chmod 644 index.html
Generally, we use:
Folders → 755
Files → 644
Understanding Numeric Permissions
The numbers represent permission levels:
7 = Read + Write + Execute
5 = Read + Execute
5 = Read + Execute
644 means:
6 = Read + Write
4 = Read
4 = Read
Instead of memorizing, practice using them regularly.
chown Command
To change a file's owner, use chown:
chown
For example:
sudo chown ubuntu:ubuntu index.php
This is frequently used to resolve permission issues when operating a web server.
Why Use sudo?
Important tasks require administrator privileges in Linux, so you'll often add sudo before commands:
sudo
However, using sudo unnecessarily is not recommended.
It's safer to use it only when needed for better server management.
Useful Terminal Shortcuts
Here are some helpful terminal shortcuts:
↑ : Previous command
↓ : Next command
Tab : Autocomplete
Ctrl + C : Terminate running process
Ctrl + L : Clear screen
Ctrl + D : Log out
The Tab autocomplete feature significantly boosts productivity.
What You've Learned Today
We've covered the essential commands for basic Ubuntu Server management.
With these skills, you can freely navigate your server, create or delete files, and manage permissions.
In our next session, we'll build on this foundation to install and operate a real web server.
Key Takeaways
pwd checks your current directory location.
ls lists files and folders in the current directory.
cd navigates between directories.
mkdir creates new folders.
touch creates empty files.
cp and mv handle file copying and moving.
rm deletes files; use rm -rf with caution.
nano is an easy-to-use editor for beginners.
chmod changes permissions.
chown modifies file ownership.
Understanding Linux permissions leads to safer server management.
Next Lesson Preview
4th Lesson: Installing Nginx and Running Your First Website
In our next session, we'll install Nginx on Ubuntu Server and run your first website directly in a browser. This is where real server setup begins.
FAQ
Why is the terminal important for Ubuntu Server?
Most server tasks are performed through the terminal, making it essential to learn basic commands for efficient server management.
What does chmod 755 mean?
It sets permissions as read+write+execute for the owner (7), and read+execute for group and others (5 each).
Korean Source
This article is an English localization of a Korean-language report from BlogScore. Original: [Ubuntu 서버 구축] 3강. 터미널 명령어와 파일·폴더 관리, 권한(chmod/chown) 완벽 이해하기