0% found this document useful (0 votes)
24 views

Basic Linux Commands

Uploaded by

sreejeet17111995
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
24 views

Basic Linux Commands

Uploaded by

sreejeet17111995
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 7

Basic Linux Commands

1. ls : ls is a command to list computer files in Unix and Unix-like operating systems. When
invoked without any arguments, ls lists the files in the current working directory. The
command is also available in the EFI shell. ls only show visible file and folder of the
current directory where ls -al show all file and folder of current directory even if it was
hidden by default.

2. cd : The cd command is known as change directory, is a command-line shell command


used to change the current working directory in various operating systems. It can be used
in shell scripts and batch files. To use this command type cd <folder name / location> to
go to that folder or cd .. to go back to previous folder location.
3. pwd : In Unix-like and some other
operating systems, the pwd command
(print working directory) writes the full
pathname of the current working
directory to the standard output.

4. su : The Unix command su, which stands for 'substitute user' (or historically 'superuser'),
is used by a computer user to execute commands with the privileges of another user
account after typing its password. When executed it invokes a shell without changing the
current working directory or the user environment. When the command is used without
specifying the new user id as a command line argument, it defaults to using the
superuser account (user id 0) of the system.

5. whoami : whoami is a command found on most Unix-like operating systems and even
in every Microsoft Windows operating system since Windows Server 2003. It is a
concatenation of the words "Who am I?" and prints the effective username of the current
user when invoked.

6. mkdir : The mkdir stands for make


directory. In the Unix, DOS, IBM OS/2
and Microsoft Windows operating
systems this command is used to make
a new directory. It is also available in the
EFI shell and in the PHP scripting
language. In DOS, OS/2 and Windows,
the command is often abbreviated to
md. To make directory in current
directory type mkdir <folder name /
location>.
7. touch : The touch is a command
used to update the access date
or modification date of a
computer file or directory. User
can also make empty file using
touch command when needed.

8. cat : cat is a standard Unix utility


that reads files sequentially,
writing them to standard output.
The name is derived from its
function to concatenate files
(from Latin word catenare
meaning "to chain"). To view
content of a file type cat <file name / file location with file name>.

9. gedit : gedit is the default text editor of the GNOME desktop environment and part of the
GNOME Core Applications. Designed as a general-purpose text editor, gedit emphasizes
simplicity and ease of use, with a clean and simple GUI, according to the philosophy of
the GNOME project. It includes tools for editing source code and structured text such as
markup languages. To edit file in gedit type gedit <file name / file location with file
name>.

10. nano : GNU nano is a text editor for Unix-like computing systems or operating
environments using a command line interface. It emulates the Pico text editor, part of the
Pine email client, and also provides additional functionality. Unlike Pico, nano is licensed
under the GNU General Public License (GPL). To edit file using nano editor type nano
<file name / file location with file name >. To save and get out of the editor press
ctrl+O  enter  ctrl+X.
11. wc : wc (short for word count) is a command in Unix and Unix-like operating systems.
The program reads either standard input or a list of computer files and generates one or
more of the following statistics: newline count, word count, and byte count. If a list of files
is provided, both individual file and total statistics follow. To see all stats type wc <file
name>.

12. cp : cp is a command in various Unix and Unix-like operating systems for copying files
and directories. To copy file from one directory to another type cp <file name / file
location with file name> <directory location where the file will be pasted>.

13. mv : mv is a Unix command that moves one or more files or directories from one place to
another. If both filenames are on the same filesystem, this results in a simple file rename
otherwise, the file content is copied to the new location and the old file is removed. To
move file from one directory to another type cp <file name / file location with file
name> <directory location where the file will be pasted>.

14. rm : rm (short for remove) is a


basic command on Unix and Unix-
like operating systems used to
remove objects such as computer
files, directories and symbolic links
from file systems. To remove file
type rm <file name / file location
with file name>. To remove all
directory as well as its sub-directory type rm -r <directory name / directory location
with sub-directory name>.
15. rmdir : rmdir is a command which will remove an empty directory on unix or unix-like
operating systems. To remove empty directory type rmdir <directory name / directory
location with empty directory name>.

16. passwd : passwd is a command on


unix and most unix-like operating
systems used to change a user's
password. To change password type
passwd <user name >  enter 
enter current password  enter new
password and again re-enter it.

17. chmod : In Unix and Unix-like operating systems, chmod is the command and system
call used to change the access permissions and the special mode flags (the setuid,
setgid, and sticky flags) of file system objects (files and directories). Collectively these
were originally called its modes and the name chmod was chosen as an abbreviation of
change mode. There are different level of mode 777 for read, write, execute permission,
444 for read only permission only, 222 for write only permission, 111 for execute only
permission, 000 for no permission and customizable permission by adding 1,2,4.
18. ifconfig : ifconfig (short for interface config) is a system administration utility in Unix-like
operating systems for network interface configuration. ifconfig commonly use to see
active ip addresses of the machine. In latest version of linux ip add and ip route
commands can be used to get all information about active network of users device.

19. traceroute : traceroute is computer network diagnostic commands for displaying


possible routes (paths) and measuring transit delays of packets across an Internet
Protocol (IP) network. The command traceroute is available on many modern operating
systems. On Unix-like systems such as FreeBSD, macOS, and Linux it is available as a
command line tool. Traceroute is also graphically accessible in macOS within the
Network Utilities suite. In windows it is rename as tracert. To run this command type
traceroute <ip address / website url>.
20. echo : echo is a command that outputs the strings that are passed to it as arguments. It
is a command available in various operating system shells and typically used in shell
scripts and batch files to output status text to the screen. We can also use echo to save
the output in a file using “>” symbol.

21. wget : GNU wget (or just wget, formerly Geturl, also written as its package name, wget)
is a computer program that retrieves content from web servers. It is part of the GNU
Project. Its name derives from "World Wide Web" and "get." It supports downloading via
HTTP, HTTPS, and FTP. We can download any type of content by typing wget <url of
the content>.

You might also like