Linux Tutorial for Beginners - arieldo/MorBot GitHub Wiki
This is a short Linux tutorial for beginners, which will help you learn some basic commands and concepts to get started with Linux.
- Introduction to Linux
- Linux Distributions
- Basic Linux Commands
- Working with Files and Directories
- File Permissions
Linux is an open-source operating system (OS) based on UNIX, which provides a free and customizable alternative to other proprietary OS like Windows or macOS. It is widely used in servers, embedded systems, and more recently, in desktop and mobile devices.
There are many distributions (also called "distros") of Linux, which are variations of the Linux OS built on top of the Linux kernel. Some popular distros include:
- Ubuntu
- Fedora
- Debian
- Arch Linux
- CentOS
These are some basic Linux commands you should know as a beginner:
-
sudo
: to run the commands as the root user (like administrator in windows) -
pwd
: Print the current working directory. -
ls
: List the contents of a directory. -
cd
: Change the current working directory. -
mkdir
: Create a new directory. -
touch
: Create a new file. -
cp
: Copy a file or directory. -
mv
: Move or rename a file or directory. -
rm
: Remove a file or directory.
Here are some examples of how to use the basic Linux commands to work with files and directories:
- To list the contents of the current directory, run:
ls
- To change the working directory to 'example', run:
cd example
- To create a new directory called 'new_directory', run:
mkdir new_directory
- To create a new file called 'new_file.txt', run:
touch new_file.txt
- To copy 'file.txt' to 'copied_file.txt', run:
cp file.txt copied_file.txt
- To move 'old_file.txt' to 'new_file.txt', run:
mv old_file.txt new_file.txt
- To remove a file called 'file_to_remove.txt', run:
rm file_to_remove.txt
- To remove a directory called 'directory_to_remove', run:
rm -rf directory_to_remove
- To run as root the command ls as the root user, run:
sudo ls
In Linux, files and directories have permissions that determine who can read, write, and execute them. Permissions are represented by three sets of characters (rwx), where 'r' stands for read, 'w' for write, and 'x' for execute.
To view the permissions of files and directories in the current directory, run: ls -l
To change the permissions of a file or directory, use the chmod
command followed by the permission mode and the file or directory name. For example, to give read, write, and execute permissions to the user for 'file.txt', run: sudo chmod u+rwx file.txt
That's it! This short tutorial should help you get started with Linux. There's a lot more to learn, so keep exploring and experimenting with different commands and concepts. Good luck!