What is Linux?
Linux is an Operating System based on the Linux Kernel created by Linus Torvalds. It's most popular "Open Source" Operating System.
Official Website : https://linux.org/
GitHub repo : https://github.com/torvalds/linux
Learn more about git here
What is meant by open source?
Open source means that you can modify the code and redistribute it. Anyone can fix bugs, add features, additional functionalities, etc and contribute to any software that is open source.
Before knowing the commands in Linux, you should realise that memorizing commands is not really necessary, you need not to remember each and every command.
Most of the commands in linux have a help menu, you can access the help menu like this
The man command displays the manual page for the given command. A man page (short for manual page) is a form of documentation that can be referred to know about the program or its arguments
Switch between directories using the cd command
You can return from a directory to the root directory just by using cd without additional arguments.
The ls command lists the files and folders (content) in a directory
The "ls -a" lists all folders or files which are usually hidden, where "a" is an argument which is short for "--all"
The pwd is short for "present working directory", It prints the current directory you are in
The su command is used to switch user
sudo is used to get "root" user privileges, the root user also called "superuser", is most privileged user on Linux, root user has access to everything on the system. Note that running a process with superuser privilege might be risky!
The mkdir command is used to make a directory/folder
The rmdir command is used to remove a directory/folder.
The "directory must be empty" to use this command or Linux would tell you that you can't do it until you empty the directory using rm command
The rm command is used to remove files in a directory, it can also be used to remove directories using arguments such as -f (--force)
The mv command is used to move or rename files
To move files
mv Directory/file Destination/
To rename files
mv file-name new-file-name
The directories can also be moved and renamed in the same way
The cp command is used to copy files and directories.
cp file Destination/
To copy directories -r argument is used, it is used to copy folders recursively
cp Directory -r Destination/
The history command displays a list of the previously used commands
We can clear the command history using the -c argument
It is used to create any file, the file created is empty. The timestamps of a file can be created, modified using touch. Learn more about timestamps here
The cat command prints contents of a file
The ping command is used to check network connectivity between host and server. We can pass an IP address or a URL in the ping command, to check whether we are able to communicate with the host/server or to find the stats of the connection. Ping stands for "Packet Internet Groper". The time recorded to get a response from the host/server is called "latency" . Low latency with low packet loss indicates faster connection
ping mozilla.org PING mozilla.org (184.108.40.206) 56(84) bytes of data. 64 bytes from mozilla-org.public.mdc1.mozilla.com (220.127.116.11): icmp_seq=1 ttl=45 time=326 ms 64 bytes from mozilla-org.public.mdc1.mozilla.com (18.104.22.168): icmp_seq=2 ttl=45 time=255 ms 64 bytes from mozilla-org.public.mdc1.mozilla.com (22.214.171.124): icmp_seq=3 ttl=45 time=248 ms ^C --- mozilla.org ping statistics --- 3 packets transmitted, 3 received, 0% packet loss, time 2002ms rtt min/avg/max/mdev = 248.005/276.200/325.687/35.105 ms
The echo command is used to print a string or text
echo "Hello! World." Hello! World.
The clear command clears the terminal screen
The exit command terminates the running program or shell
I hope you found this article helpful, please do share it with your friends.