Basic Linux Commands
Basic Linux Commands
COMMANDS
Understanding the Basics of the Linux administration 1
[email protected]
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.
[email protected] 2
WORKING DIRECTORY AND
NAVIGATION
Command: pwd
- Print the current working directory.
Command: cd
- Change the directory.
[email protected] 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}.
[email protected] 4
ECHO COMMAND
Command: echo
- Print data to the terminal or write to a file.
Example: echo "Hi dear STD!" > test.txt.
[email protected] 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.
[email protected] 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.
[email protected] 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.
[email protected] 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.
[email protected] 9
USER INFORMATION
Command: whoami
- Display the current user information.
[email protected] 10
SSH COMMAND
Command: SSH - [email protected]
Allows remote login to another machine securely over a network.
[email protected] 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.
[email protected] 12
Q&A
Any questions?