Commands Linux
Commands Linux
1. Echo
• input back to the user on the screen ,
commonly used to send information to the
user in a script.
2.touch
• Change the time of access or modification
time of a file to the current time.
• In addition, the touch command creates an
empty file if the file name specified as an
argument does not exist.
3.ls
• List the files in the current working directory.
This command displays only the file name
when the command is run without any options.
However, it can be used to list information
such as size, file type, and permissions by
running the command with the respective
options.
4.gedit
5. cat
6. pwd
• Displays current working directory you are in.
• Return the path to your current working
directory.
7. cal
8. date
9. last
10. mkdir
11. rmdir
Create File with echo Command
Create File with cat Command
Linux commands
• Is – Displays information about files in the current directory.
• pwd – Displays the current working directory.
• mkdir – Creates a directory.
• cd – To navigate between different folders.
• rmdir – Removes empty directories from the directory lists.
• cp – Moves files from one directory to another.
• mv – Rename and Replace the files
• rm – Delete files
• uname – Command to get basic information about the OS
• locate– Find a file in the database.
• touch – Create empty files
• cat – Display file contents on terminal
• clear – Clear terminal
• ps- Display the processes in terminal
• man – Access manual for all Linux commands
• grep- Search for a specific string in an output
• echo- Display active processes on the terminal
• whoami- Create or update passwords for existing users
• sort- sort the file content
• cal- View Calendar in terminal
• whereis – View the exact location of any command types after this command
• df – Check the details of the file system
• wc – Check the lines, word count, and characters in a file using different
options
Introduction to users
1. whoami
The whoami command tells you your username.
2. who
The who command will give you information about who is logged on the system.
3. w
The w command shows you who is logged on and what they are doing.
4. id
The id command will give you your user id, primary group id, and a list of the
groups that you belong to.
5. su to another user
The su command allows a user to run a shell as another user.
6. su to root
Yes you can also su to become root,
when you know the root password.
7. su as root
You need to know the password of
the user you want to substitute to,
unless your are logged in as root.
The root user can become any
existing user without knowing that
user's password.
8. su - $username
By default, the su command
maintains the same shell
environment. To become another
userand also get the target user's
environment, issue the su -
command followed by the
9. /etc/passwd
The local user database on Linux (and on
most Unixes) is /etc/passwd.
• As you can see, this file contains seven
columns separated by a colon. The
columns containthe username, an x, the
user id, the primary group id, a
description, the name of the home
directory, and the login shell. More
information can be found by typing man
5 passwd.
10. root
• The root user also called the superuser
is the most powerful account on your
Linux system.
• This user can do almost anything,
including the creation of other users. The
root user always has userid 0 (regardless