Knowledge Base | Linux Basic Commands You Should Know

Linux Commands

Here are the basic linux commands and their uses:

  1. pwd command

pwd Use the command to find out what directory (folder) you are in. As a result, the command will give you a precise and exact location. Location usually with a slash (/) starts. Here is a full location example / home / username.

  1. cd command

To navigate the Linux file system cd Use the command. It requires either the exact location or the name of the directory, depending on the current directory you are in.

Let’s say /home/kullaniciadi/Documents You are in the directory and Documentssubdirectory of PhotosYou want to go to. To do this, all you have to do cd Photos is to enter the command.

As another example, let’s say it is in a completely new directory /home/kullaniciadi/Movies you want to pass. In this case cd and then you need to enter the exact location of the directory.

There are some shortcuts if you want to change location faster. If you want to go to a higher directory cd.. (with a colon) or if you want to go directly to the home directory cd use. If you want to go to the previous directory cd- You can use (hyphenated).

Additionally, the Linux shell is case sensitive. That’s why you must enter the name of the directory as it is.

  1. ls commute

ls command is used to view the contents of a directory. By default, this command will display the contents of the current directory.

If you want to see the content of other directories ls and you must enter the location of the directory. For example, Documentsto see the content of ls /home/kullaniciadi/Documents Enter the command.

  1. cat command

cat It is one of the frequently used commands in Linux. Used to view the contents of a file on standard output (sdout). To run this command, first cat, then enter the file name and extension. For example: cat dosya.txt

  1. cp command

cp Use the command to copy files from the current directory. For example, cp ornek.jpg /home/kullaniciadi/Pictures command ornek.jpg file Pictures creates a copy in the directory.

  1. mv command

The next command on our list of Linux commands is mv command. The main use of this command is to move files but it can also be used to rename files.

The use of this command is also cp It is very similar to the command. Prior to mv, then you must enter the name of the file and the target directory. For example: mv dosya.txt /home/kullaniciadi/Documents.

The syntax required to rename files is mv eskiad.ext yeniad.ext

  1. mkdir command

mkdir Use the command to create a new directory. For example, mkdir Muzik, Grind It will create a new directory named.

  1. rmdir command

If you need to delete a directory rmdir Use the command. However, rmdir only allows you to delete empty directories.

  1. rm command

rm The command is used to delete directories with their contents. If you just want to delete the directory, as an alternative to rmdir rm -r use.

  1. touch command

touch Allows you to create new empty files via the command line. For example Documents under the directory Web touch to create an HTML file named /home/kullaniciadi/Documents/Web.html enter.

  1. locate command

You can use this command to find the location of a file, just like the search command in Windows. Moreover, this command will remove it case insensitivity. -i With option, you can search with this command even if you don’t remember the name of the file.

Asterisk to search for a file containing two or more words use. For example, locate -i okul*not

  1. command will search for all files containing the words “school and” note, regardless of upper or lower case characters.

find komutu locate Similar to the command find

command is also used to search for files. The difference is that the command is used to find files in a specific directory. As an example /home/ -name notlar.txt command notlar.txt

  1. used to search for a file named in the home directory and its subdirectories.

grep command Another command that is very useful for daily use isgrep ‘shoot. grep

command is used to search text in a particular file. For example, grep blue notdefteri.txt

  1. will search for the word blue in the notepad file. Words containing this word will be displayed exactly.

sudo komutuSuperUser Do

  1. This command, short for ”, allows you to perform tasks that require administrator or root permissions. However, this command is not recommended for daily use because if you do something wrong, it is quite easy to get an error.

df command 15th in our list of Linux commands df You can use the command to find the system’s disk space usage in percent and KB (kilobytes). If you want to view the report in megabytes df -m

  1. use.

du command If you want to check how much space a file or directory takes up of( Disk Usage You must use the – Disk Usage) command. However, the disk usage summary will show disk block numbers instead of the normal size format. If you want to see the summary in bytes, kilobytes and megabytes, click the command line. -h

  1. Add option.

head command head command is used to display the first line of any text file. By default, the first ten lines will be shown, but you can change this number as you wish. For example, if you want the first five lines to be displayed head -n 5 dosyaadi.ext

  1. Enter the command.

tail command This command head has a similar function to command. Instead of showing the first lines tail

  1. command will display the last ten lines of a text file.

diff commanddifference short for diff

The command compares the contents of two files line by line. After analyzing the files, it will return lines that do not fit. Programmers often use this command to make changes to the program, rather than rewriting the entire source code. The simplest form of this commanddiff dosya1.ext dosya2.ext

  1. ‘to you.

tar command tar command multiple files into onetarball Commonly used for archiving to.tarball

The format is similar to the zip format, but compression is optional.

  1. This command is to add new files to an existing archive, list the contents of an archive, extract content from an archive, etc. It is quite complex since it has various functions such as. You can learn more about other functions by taking a look at some practical examples.

chmod command Another important command on our list of Linux commands ischmod ‘hard. chmod Used to change read, write and run permissions of files and directories. This command is a bit complicated so you can use it correctly. this guide

  1. You can read (ing).

head chown All files in Linux have a specific owner. chown command is used to transfer ownership of a file to a specific user. For example,chown linuxuser2 file.ext linuxuser2 ‘yifile.ext

  1. will do.

jobs command jobs

  1. command will display all jobs with their status. A job is simply a shell-initiated process.

kill komutu If there is a program that is not responding kill

You can terminate the program manually using the command. This command will send a specific signal to the application that is not responding and instruct the application to terminate itself.

  • There are about forty signals in total that you can use, but generally these two signals are used: SIGTERM (15)
  • – asks a program to stop running and gives it some time to save its state. If you do not specify the signal when entering the kill command, this signal will be used. SIGKILL (9)

– force program termination immediately. You lose the unsaved state. Apart from knowing the signals, you also need to know the process identification number (PID) of the program you want to terminate. If you don’t know PID ps ux

Run the command.

After making sure you know what signal to use and the program’s PID, enter the following syntax: [sinyal seçeneği] killPID

  1. .

ping command ping Use the command to check your connection to a server. For example, ping google.com

  1. You can find out if you can connect to Google and measure the response time by entering the command.

wget komutu Linux commands are very useful. wget You can even download files from the Internet with the help of the command. To do this wget

  1. and then enter the link of the file you want to download.

you lie to a person Unix Name for abbreviated uname

  1. command about your Linux system, machine name, operating system, kernel, etc. It will give information such as.

top command An equivalent of Task Manager in Windows top

  1. command will show the list of programs that are running and how much CPU those programs are using. It is very useful to monitor the usage of system resources and will especially help you to terminate programs that use up system resources.

history command After using Linux for a while, you will notice that you run hundreds of commands every day. If you want to see commands you have entered before history

  1. You can run the command.

man command Have you forgotten which command has which function? Don’t worry. The last command on our list of Linux commands, man You can learn commands from the Linux shell using the command. For example, man tail enter command tail

It will display the instructions for using the command.

Author: Samed Gül

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *