Learning Linux- Basic Commands

Beginner Guide to Learning Ubuntu

Mariam Manzoor
ILLUMINATION
3 min readOct 3, 2020

--

Photo from https://en.wikipedia.org/wiki/Ubuntu

Linux is an operating system, just like Windows and macOS. It’s free and perfect for programmers. Linux shell is one of the many features that add to the operating system's worth. In this article, we’ll dive into some basic shell commands of a Linux distro, Ubuntu.

Opening Command-Line

image courtesy author

To open the Terminal press CTRL + ALT + T or navigate to Show Application and search Terminal

Finding Current Directory

image courtesy author

By default, when you open the terminal, you are in home directory of a user.

To find which directory you are currently in, the command pwd is used.

Listing File/Folders in a Directory

image courtesy author

To display all the files and folders in the current directory, the command ls is used.

To display them as a list, the flag -l is added: ls -l.

To display the contents of another directory ls -l <path> is used.

Changing Directories

image courtesy author

In order to move into a sub-directory, the command used is cd <directory name>.

To go back to the parent folder, cd .. is used. And to return to home directory cd ~ is used.

Another command to change directory is cd <path>.

Making a New Directory and File

image courtesy author

To make a new folder, cd into the directory you want to create the new folder in, and type: mkdir <Folder Name>

Incase file name contains spaces, enclose the name in ‘ ’.

image courtesy author

To make a new file, cd into the directory you want to create the file in, and type: touch <File Name>

Deleting a Directory and Files

image courtesy author

To delete a file, cd into the directory you want to delete the file from and type the command: rm <File Name>.

To delete a folder you may use either of these two commands: rmdir ‘File B’ or rm -r ‘File A’.

Copying a File

image courtesy author

To copy a file, cd into its directory and use the command cp <File Name> <New Path>.

Renaming and Moving the File

image courtesy author

To rename a file, use command mv <Old Name> <New Name>

image courtesy author

To move a file, use the command mv <File Name> <New Path>

Conclusion

These were some basic Linux commands. Further, clear command can be used to clean the terminal, CTRL +C to cancel the current process in the terminal, CTRL + SHIFT + C to copy from the terminal, and CTRL + SHIFT + V to paste to the terminal.

Practice these commands on your machine, and master Linux the commands for beginners.

--

--

Mariam Manzoor
ILLUMINATION

Hey Friends! I’m Mariam, a Science and Technology Enthusiast and I’m here to share my Ideas and Explorations in the field of AI and Robotics.