Linux fundamental commands
My Linux journey started off with using Ubuntu and exploring how to use it , since then I have changed quite a few distributions and currently stuck with Arch (Did I install it … Nah, my friend Vishal helped me install it).
This is a certaintly not a guide for installing Arch and setting it up, rather an open ended note which might be updated periodically as i get to learn and explore more on using Linux.
- Shell
- A program that receives commands from the keyboard and send them to the OS for the respective action to be performed.
While navigating the file using the shell , use pwd to know the path currently present. To change the directory use cd command.
cat - displays the contents of the file, dont use it for files that has a lot of content
cat slimshady.py
cp - creates a copy of file from one location to another
cp random_file /home/docs/randomstuff
mv - Used for moving as well as renaming files
mv hi hello
- This renames the file hi to hello
mv file1 /home/docs/randomstuff
- This moves file1 to a folder called randomstuff
mkdir - Used for creating directories to store the files
mkdir Learn
rm , rmdir - Used to remove files(Super handy). Do note than once removed there is no trash from which you can recover, its gone for ever.
rm file1
- Removes a file named file1rmdir Learn
- Removes the directory Learn
All these basic commands are more than enough to get started, in fact at this stage i feel you really do not need anything more fancy than this.
Once you’re comfortable with the basics, you can start exploring more advanced commands. Here are few more commands that can be get you started
- touch - Creates an empty file or updates the timestamp of an existing file
touch newfile.txt
- find - Searches for files and directories based on criteria like name, size, or modification time.
find /home/docs -name "*.txt"
find /Pictures -name "*.jpg"
- grep - Searches for text within files.
grep "error" random_file.txt
-i
- for case insensitive matches-r
- Recursive search in directories-n
- Show line numbers