35 Linux Basic Commands Every User Should Know
Mar 21, · Linux Commands. Basic Commands. 1. pwd — When you first open the terminal, you are in the home directory of your user. To know which directory you are in, you can use the “pwd” command. It gives us the absolute path, which means the path that starts from the root. The root is the base of the Linux file system. It is denoted by a forward slash(/). Oct 07, · To learn more about bg command, read: Start Linux Command in Background and Detach Process in Terminal. bzip2 Command. bzip2 command is used to compress or decompress file(s). $ bzip2 -z filename #Compress $ bzip2 -d loveescortus.com2 #Decompress To learn more examples on bzip2, read: How to Compress and Decompress loveescortus.com2 File in Linux. cal Command.
File Management becomes easy if you know the right commands. Sometimes, commands are also referred as "programs" since whenever you run a command, it's the corresponding program code, written for the command, which is being executed. Note: Directories are denoted in blue color. Files are denoted in white.
You will find similar color schemes in different flavors of Linux. Suppose, your "Music" folder has following sub-directories and files. Libux can use 'ls -R' to shows all the files not only in directories but also subdirectories NOTE: The command is case-sensitive.
If you enter, " ls - r " you will get an error. The command provides information in a columnar format. To view hidden files, use the linu. It can also be used for copying, combining and creating new text files. Let's see how it works. As soon as you insert this command and hit enter, the files are concatenated, but you do not see a result. This is because Bash Shell Terminal is silent commmands.
It will only show a message when something goes wrong or when an error has occurred. To view the new combo file "sample" use the command cat sample Note: Only text files can be ocmmands and combined using this command.
Deleting Files The 'rm' command removes files from the system without confirmation. Currently, we are executing the command as a standard user. Hence we get the above error. To overcome the error use command.
Sudo command will ask for password authentication. Though, you do not need to know the root password. You can supply your own password. After authentication, the system will invoke the requested command. Sudo maintains a log of each command run. System administrators can trackback the person responsible for undesirable changes in the system.
This eliminates the need of entering the password time and again. Let's learn some directory manipulation Linux basic commands. Creating Directories Directories can be created on a Linux operating system using the following command mkdir directoryname Linuc command will create a subdirectory in your present working directory, which is usually your "Home Directory". Renaming Directory The 'mv' whzt command covered earlier can also be used for renaming directories.
It is similar how to fix my door handle HELP file found in popular software. To get help on any command that you do not understand, you can type man Ni terminal would open the manual page for that command.
For an example, if we type man man and hit enter; terminal would give us information on man command The History Command History command shows all the basic commands in Linux that you have used in the past for the current terminal session. This can help you refer to the old commands you have entered and re-used them in your operations again. The clear command This command clears th the clutter on the terminal and gives you a clean window to work on, just like when you launch the terminal. Pasting commands into the terminal Many times you would have to type in long commands on linkx Terminal.
Well, it can be annoying at times, and if iin want to avoid such a situation then copy, pasting the commands can come to rescue. What more, your original file does not get affected at all by the formatting that you do. Let us learn about these commands and their use. Click here if the video is not accessible. This command helps in formatting the file for printing on the terminal.
There are many options available with this command which help in making desired format changes on file. The most used ' pr' options are listed below. Default is 56 -o margin Formats the hwat by the margin number Let us try some of the options and study their effects.
Dividing data into wuat ' Tools' aee a file shown lonux. We want its content to afe arranged in three columns. The syntax for the same would be: pr -x Filename The '-x' option with the 'pr' command divides the data into what is the al jazeera logo columns. Assigning a header The commmands is: pr -h "Header" Filename The '-h' options assigns "header" value commanda the report header.
As shown above, we have arranged the file in 3 columns and assigned a header Denoting all lines with numbers The syntax is: pr -n Ard This command denotes all the lines in the file with numbers. These are some of the 'pr' command options that you can use to modify the file format. Printing a file Once you are done with the formatting, and it is time for you to get a hard copy of the file, you need to use the following command: lp Filename or lpr Filename In case you want to print multiple copies of the file, you can use the number modifier.
In case you have multiple printers configured, you can specify a particular printer using the Printer modifier Installing Software In windows, the installation of a program is done by running the setup.
The installation bundle contains the program as well various dependent components required to run the program correctly. But the package contains only the program itself. Any dependent components will have to be installed separately which are usually available as packages themselves. You can use the apt commands to install or remove kn package. Let's update all the installed packages in our wha using command - sudo jn update The easy and popular way how to decorate a dining room hutch install programs on Ubuntu is by using the Software center as most of the software packages are available on it and it is far more secure than the files downloaded from the internet.
Linux Mail Command For sending mails through a terminal, you will need to install packages 'mailutils'. The command syntax is - sudo apt-get install packagename Once done, you can then use the following syntax for sending an email. The mail will be sent to the mentioned address. Summary You can format and print a file directly from the terminal. A package contains the program itself. Any dependent component needs to be downloaded separately.
You can also send e-mails from terminal using the 'mail' network commands. It is very useful Linux command. Linux Command List Below is a Cheat Sheet of Linux commands commqnds we have learned in this Linux commands tutorial Command Description ls Lists all files and directories in the present working directory ls - R Lists files in sub-directories as well ls how to calculate weight maintenance calories a Lists hidden files as well ls - al Lists files and directories with detailed information like permissions, size, owner, etc.
Home Testing. Must Learn! Big Data. Live Projects. Lunux is Sponsored by Acunetix. Acunetix, the developers of dead-accurate web application security scanners have sponsored the Guru99 project to help scan for over web vulnerabilities accurately and at top speed. Visit the Acunetix Website.
Listing Hidden Files
Linux commands may seem intimidating at first glance if you are not used to using the terminal. There are many commands for performing operations and processes on your Linux system. No matter whether you are new to Linux or an experienced user, having a list of common commands close at hand is helpful.
In this tutorial, you will find commonly used Linux commands as well as a downloadable cheat sheet with syntax and examples. Important : Depending on your system setup, some of the commands below may require invoking sudo to be executed. If you prefer having all the commands on a one-page reference sheet, we created a helpful Linux command line cheat sheet. Search for a specific pattern in a file with:. List all files shows hidden files :.
Create a new directory :. Remove a file :. Copy the contents of one file to another file:. Note: Want to read more about file creation? Check out an article about how to create a file in Linux using the command line. Extract an archived file :.
Copy a file to a server directory securely:. Synchronize the contents of a directory with a backup directory using the rsync command :. Display who is currently logged into the system with the who command :. Temporarily elevate user privileges to superuser or root using the sudo command :.
Note: If you want to learn more about users and groups, take a look at our article on how to add a user to a group in Linux. List all installed package s with yum :. Install a package using the APT package manager :. Terminate a Linux process under a given ID :. Note: If you want to learn more about shell jobs, how to terminate jobs or keep them running after you log off, check out our article on how to use disown command.
See kernel release information :. You can use the df and du commands to check disk space in Linux. See disk usage for all files and directory :. Chown command in Linux changes file and directory ownership. Give read, write, and execute permission to owner , and r ead and execute permission to group and others :. Assign full permission to owner , and read and write permission to group and others :.
Note : To learn more about how to check and change permissions, refer to our Linux File Permission Tutorial. List IP addresses and network interfaces :. See active listening ports with the netstat command :.
Show DNS information about a domain using the dig command :. Download a file from a domain using the wget command :. The process can be resumed in the foreground with fg or in the background with bg. The more you use Linux commands, the better you will get at remembering them. Do not stress about memorizing their syntax; use our cheat sheet. Web Servers , SysAdmin. In most modern Linux operating systems, managing a service is quite simple when it comes to basic commands.
Read More. In this tutorial, learn the five most commonly used commands to check memory usage in Linux. We also provide…. This article lists the most commonly used commands and tools to remove unwanted files and directories from….
Security , SysAdmin. How to Use the su Command in Linux with Examples. Learn how to use the su command with practical examples and explanations. Change users in the terminal window…. Alongside her educational background in teaching and writing, she has had a lifelong passion for information technology. She is committed to unscrambling confusing IT concepts and streamlining intricate software installations. Linux Commands List. The commands found in the downloadable cheat sheet are listed below.
Hardware Information. File Commands. Directory Navigation. Move up one level in the directory tree structure: cd.. File Compression. File Transfer. Package Installation. Process Related. System Information.
Show system information : uname -r See kernel release information : uname -a Display how long the system has been running , including load average: uptime See system hostname : hostname Show the IP address of the system: hostname -i List system reboot history : last reboot See current time and date : date Query and change the system clock with: timedatectl Show current calendar month and day : cal List logged in users : w See which user you are using : whoami Show information about a particular user : finger [username].
Disk Usage. SSH Login. Connect to host as user: ssh user host Securely connect to host via SSH default port ssh host Connect to host using a particular port : ssh -p [port] user host Connect to host via telnet default port 23 : telnet host.
File Permission. Linux Keyboard Shortcuts. Log out of current session: exit. Whenever in doubt, refer to this helpful guide for the most common Linux commands. Next you should also read.