Basics Linux Commands
Overview
Tutorial: 30 min
- Objectives:
Learn how to use Gadi terminal.
Learn some basic Linux commands.
File and Directory Management
ls: List files and directories.
Detailed list view with permissions, size, and timestamps:
1ls -l
Show hidden files:
1ls -a
cd: Change directory to a specified directory.
Move to a specified directory.
1cd /path/to/directory
Move up one directory level:
1cd ..
Move to your home directory:
1cd ~
pwd: Print the current working directory.
1pwd
mkdir: Create a new directory.
1mkdir test
touch: Create a new file.
1touch test.txt
rm: Remove files or directories.
Remove files:
1rm test.txt
Remove directories:
1rm -rf test
cp: Copy files or directories
Copy file1 to file2:
1touch file1.txt
2cp file1.txt file2.txt
Recursively copy directory1 to directory2
1mkdir dir1
2cp -r dir2
mv: Move or rename files or directories.
Move files:
1mv file1.txt file2.txt
Move directories:
1mv dir1 dir2
Process Management
top: Display real-time information about system processes
1top
ps: List currently running processes
1ps -aux
kill: Terminate a process
1kill <pid>
File Transfer
scp: Securely copy files between local and remote systems.
Copy local_file to a remote path on Gadi
1scp local_file user@gadi.nci.org.au:/remote/path
Copy file from Gadi to the current local directory.
1scp user@gadi.nci.org.au:/remote/path/file .
Text Viewing and Editing
cat: Display the contents of a file.
1cat file.txt
less: View file content page by page.
1less file.txt
nano: Simple text editor.
1nano file.txt
vim: Advanced text editor.
1vim file.txt