Linux commands
Linux commands
Being a developer you might have focused your skills on problem-solving and
data structures. However, consider a scenario where you’re executing code,
but your program runs too slowly. You check your code, and you find that
there is nothing wrong with your code. What could be the reason behind this?
Well, one of the reasons could be your operating system. If you need to
debug your program then how would you do that if you don’t know how your
operating system works? Some possibilities are that you’re accessing too
many files, you’re running out of memory or that swap is in high usage.
Threads
You can define a thread as a flow of execution through the process code. The
thread keeps track of all the instructions that need to be executed next in the
program counter. Also, the thread contains system registers that hold the
current working variables. Also, the thread's stack contains the execution
history.
Scheduling
Memory Management
Linux is a free and open-source software that operates on its own operating
system. The term ‘Linux’ stands for GNU + Linux. Initially developed by
Linus Torvalds, it was created alongside the source code of Unix.
Linux commands are a type of Unix command or shell procedure. They are
the basic tools used to interact with Linux on an individual level. Linux
commands are used to perform a variety of tasks, including displaying
information about files and directories.
Commands
1. Is command in Linux
The ls command is commonly used to identify the files and directories in the
working directory.
The pwd command is mostly used to print the current working directory on
your terminal.
This mkdir command allows you to create fresh directories in the terminal
itself. The default syntax is mkdir <directory name> and the new directory
will be created.
Mkdir linux
4. cd command in Linux
Rmdir linux
6. cp command in Linux
Cp file1.txt file2.txt
7. mv command in Linux
Mv file1.txt rename.txt
8. rm command in Linux
The locate command is generally used to locate the files in the database.
Use an asterisk (*) to search for content that contains two or more words. As
an example: locate first*file. This command will search the database for
the files that contain these two names first and file.
Locate rename
The touch command creates an empty file when put in the terminal in this
format as touch <file name>
Touch file.txt
Mkdir Demo
Mkdir Linked
Ln -S Demo Linked
The cat command is the simplest command to use when you want to see
the contents of a particular file.
Cat rename.txt
AzureAD+RemyaGopalakrishnan@Rev-PG02Q4F4 MINGW64 ~
$ ls
'#11529788.xls'
'#30875EAF.pptx'
'#5FFC725E.jpg'
'#99745836.doc'
'$0049E269.pptx'
'$3F10BB8A.jpg'
'$43FA8C3C.doc'
'$F77FDBC5.xls'
'3D Objects'/
AppData/
'Application Data'@
Contacts/
Cookies@
Documents/
Downloads/
Favorites/
IntelGraphicsProfiles/
Links/
'Local Settings'@
Music/
'My Documents'@
NTUSER.DAT
NTUSER.DAT{49a2fef9-b067-11ef-8227-84a93855a2a7}.TM.blf
NTUSER.DAT{49a2fef9-b067-11ef-8227-
84a93855a2a7}.TMContainer00000000000000000001.regtrans-ms
NTUSER.DAT{49a2fef9-b067-11ef-8227-
84a93855a2a7}.TMContainer00000000000000000002.regtrans-ms
NetHood@
OneDrive/
'OneDrive - revature.com'/
Postman/
PrintHood@
Recent@
'Saved Games'/
Searches/
SendTo@
'Start Menu'@
Templates@
Untitled.ipynb
Untitled1.ipynb
Untitled2.ipynb
Untitled3.ipynb
Videos/
anaconda3/
angular-course/
angular-firstapp/
eclipse/
eclipse-workspace/
linuxCommands/
ml-docker-app/
mlartifacts/
mlruns/
my-app/
ntuser.dat.LOG1
ntuser.dat.LOG2
ntuser.ini
test/
test.mv.db
test.trace.db
zipkin-server-2.12.9-exec.jar*
AzureAD+RemyaGopalakrishnan@Rev-PG02Q4F4 MINGW64 ~
$ pwd
/c/Users/RemyaGopalakrishnan
AzureAD+RemyaGopalakrishnan@Rev-PG02Q4F4 MINGW64 ~
$ cd linuxCommands
AzureAD+RemyaGopalakrishnan@Rev-PG02Q4F4 MINGW64
~/linuxCommands
$ mkdir linux
AzureAD+RemyaGopalakrishnan@Rev-PG02Q4F4 MINGW64
~/linuxCommands
$ ls
linux/
AzureAD+RemyaGopalakrishnan@Rev-PG02Q4F4 MINGW64
~/linuxCommands
$ mkdir command
AzureAD+RemyaGopalakrishnan@Rev-PG02Q4F4 MINGW64
~/linuxCommands
$ ls
command/ linux/
AzureAD+RemyaGopalakrishnan@Rev-PG02Q4F4 MINGW64
~/linuxCommands
$ rmdir linux
AzureAD+RemyaGopalakrishnan@Rev-PG02Q4F4 MINGW64
~/linuxCommands
$ ls
command/
AzureAD+RemyaGopalakrishnan@Rev-PG02Q4F4 MINGW64
~/linuxCommands
$ ls
command/
AzureAD+RemyaGopalakrishnan@Rev-PG02Q4F4 MINGW64
~/linuxCommands
$ cp file1.txt file2.txt
AzureAD+RemyaGopalakrishnan@Rev-PG02Q4F4 MINGW64
~/linuxCommands
$ cd command
AzureAD+RemyaGopalakrishnan@Rev-PG02Q4F4 MINGW64
~/linuxCommands/command
$ cp file1.txt file2.txt
$ ls
file1.txt.txt
AzureAD+RemyaGopalakrishnan@Rev-PG02Q4F4 MINGW64
~/linuxCommands/command
$ cp file1.txt file2.txt
AzureAD+RemyaGopalakrishnan@Rev-PG02Q4F4 MINGW64
~/linuxCommands/command
$ mv file1.txt rename.txt
AzureAD+RemyaGopalakrishnan@Rev-PG02Q4F4 MINGW64
~/linuxCommands/command
$ rm file2.txt
AzureAD+RemyaGopalakrishnan@Rev-PG02Q4F4 MINGW64
~/linuxCommands/command
$ uname
MINGW64_NT-10.0-22631
AzureAD+RemyaGopalakrishnan@Rev-PG02Q4F4 MINGW64
~/linuxCommands/command
$ locate rename
AzureAD+RemyaGopalakrishnan@Rev-PG02Q4F4 MINGW64
~/linuxCommands/command
$ locate rename.txt
AzureAD+RemyaGopalakrishnan@Rev-PG02Q4F4 MINGW64
~/linuxCommands/command
$ cd..
AzureAD+RemyaGopalakrishnan@Rev-PG02Q4F4 MINGW64
~/linuxCommands/command
$ cd linuxCommands
AzureAD+RemyaGopalakrishnan@Rev-PG02Q4F4 MINGW64
~/linuxCommands/command
$ ..cd
AzureAD+RemyaGopalakrishnan@Rev-PG02Q4F4 MINGW64
~/linuxCommands/command
$ cd/
AzureAD+RemyaGopalakrishnan@Rev-PG02Q4F4 MINGW64
~/linuxCommands/command
$ touch file.txt
AzureAD+RemyaGopalakrishnan@Rev-PG02Q4F4 MINGW64
~/linuxCommands/command
$ mkdir Demo
AzureAD+RemyaGopalakrishnan@Rev-PG02Q4F4 MINGW64
~/linuxCommands/command
$ mkdir Linked
AzureAD+RemyaGopalakrishnan@Rev-PG02Q4F4 MINGW64
~/linuxCommands/command
$ ln -S Demo Linked
AzureAD+RemyaGopalakrishnan@Rev-PG02Q4F4 MINGW64
~/linuxCommands/command
$ ln -s Demo Linked
AzureAD+RemyaGopalakrishnan@Rev-PG02Q4F4 MINGW64
~/linuxCommands/command
$ ln -S Demo Linked
AzureAD+RemyaGopalakrishnan@Rev-PG02Q4F4 MINGW64
~/linuxCommands/command
$ cat rename.txt
hello
AzureAD+RemyaGopalakrishnan@Rev-PG02Q4F4 MINGW64
~/linuxCommands/command
$ clear
The man command displays a user manual for any commands or utilities
available in the Terminal, including their name, description, and options.
Man ls
cat rename.txt
The wget command in the Linux command line allows you to download files
from the internet. It runs in the background and does not interfere with other
processes.
Wget http://www.google.com/sample.php
Whoami
The sort command is used generally to sort the output of the file.
Cat rename.txt
Sort rename.txt
The cal command is not the most famous command in the terminal but it
functions to view the calendar for a particular month in the terminal.
Cal April 2025
Df -h
we have used df -h as simply typing df will return the output in bytes which
is not readable, so we add -h to make the outputs more readable and
understandable.
touch newfile.txt
wc -w newfile.txt