Basic Linux Commands
Basic Linux Commands
COMMANDS
Understanding the Basics of the Linux administration 1
Shamsrashidy@kdru.edu.af
LIST FILES IN DIRECTORY
Command: ls
- List all files and directories in the current working directory.
Options:
- ls -l : List in long format.
- ls -a : List all files, including hidden files.
Shamsrashidy@kdru.edu.af 2
WORKING DIRECTORY AND
NAVIGATION
Command: pwd
- Print the current working directory.
Command: cd
- Change the directory.
Shamsrashidy@kdru.edu.af 3
CREATE FILES
Command: touch filename
- Create a new file (e.g., touch text.txt).
- Create multiple files: touch ab ac ad ae.
- Use brace expansion: touch node{1..10}.
Shamsrashidy@kdru.edu.af 4
ECHO COMMAND
Command: echo
- Print data to the terminal or write to a file.
Example: echo "Hi dear STD!" > test.txt.
Shamsrashidy@kdru.edu.af 5
TEXT EDITORS
Command: nano filename
- Open a file in the nano text editor.
Command: vim filename
- Open a file in the vim text editor.
- To exit: Press ESC, then type :wq to save and quit.
Shamsrashidy@kdru.edu.af 6
DISPLAY FILE CONTENTS
Command: cat filename
- Show the contents of a file.
Command: shred filename
- Permanently delete a file’s contents before removing it.
Shamsrashidy@kdru.edu.af 7
CREATE AND REMOVE
DIRECTORIES
Command: mkdir dirname
- Create a new directory.
Command: rmdir dirname
- Remove a directory.
Command: rmdir -r dirname
- Remove directories recursively.
Shamsrashidy@kdru.edu.af 8
COPY, MOVE, AND DELETE
FILES
Command: cp filename ./location/filename
- Copy a file.
Command: mv filename ./new_location/filename
- Move a file.
Command: rm filename
- Delete a file.
Shamsrashidy@kdru.edu.af 9
USER INFORMATION
Command: whoami
- Display the current user information.
Shamsrashidy@kdru.edu.af 10
SSH COMMAND
Command: SSH - rashidy@192.168.1.1
Allows remote login to another machine securely over a network.
Shamsrashidy@kdru.edu.af 11
CONCLUSION
Linux is a powerful, secure, and flexible OS.
Offers a variety of distributions tailored to different needs.
Essential for anyone interested in IT, cybersecurity, or
development.
Shamsrashidy@kdru.edu.af 12
Q&A
Any questions?
Shamsrashidy@kdru.edu.af 13