Linux Learning Notes

Programming | 08 June 2017

In this page, you will learn some of the useful Linux commands along with its descriptions. This might be used as a handy reference to quickly know about the syntax of a command and its usefulness.

Command Description
wget URL

Downloads the file specified by the URL.

pwd

Displays the current directory you are in.

sudo

Allows the user to act like a superuser.

sudo -i

Allows the user to get root access.

sudo apt-get install package_name

Allows the user to act like a superuser and install packages.

cd directory_name

Changes from current directory to the mentioned directory.

cd ..

Moves back one directory.

ls

To view the contents in a directory including files and sub-directories.

ls -a

To view the contents in a directory including hidden files.

man command

Displays the information about the command specified.

whereis file/directory

Shows where the specified file/directory is.

mkdir directory_name

Creates a directory with the given name.

mv old_filename new_filename

Renames the file.
Moves file from one location to another.

cp old_filename new_filename

Copies file from one location to another.

rm filename

Removes the specified filename.

rmdir directoryname

Removes the specified empty directory.

rm -rf directoryname

Removes files and sub-directories in the specified directory.

touch filename

Creates a new file.
Modifies the datetime of the already created filename to current datetime.

ifconfig & iwconfig

Allows the user to look at the network configuration.

ping URL

Allows the user to test connectivity issues.

vi filename

Opens the specified file in the vi editor to view/make changes.

telnet ip_address

Connects to the specified IP address.

chmod 777 file_name

Modifies the permissions of the specified file.

  • 4 - Read
  • 2 - Write
  • 1 - Execute
  • 0 - No permissions

The three digits in 777 represents users, groups and others.

7 means - 4 + 2 + 1, meaning users can read, write and execute.

chmod -R 777 directory

Modifies the permissions of the specified directory recursively. Meaning it applies the changes for all the files and sub-directories.

du -sh filename

Prints the file size

In case if you found something useful to add to this article or you found a bug in the code or would like to improve some points mentioned, feel free to write it down in the comments. Hope you found something useful here.