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

Basic Linux Commands

This document provides summaries of basic Linux commands including mkdir to create directories, cd to change directories, mv to move or rename directories, pwd to print the working directory, rmdir to remove directories, chown to change file ownership and permissions, and ls to list directory contents. It also summarizes commands for copying files like cp, creating symbolic links like ln, finding files like locate, viewing file contents like more, cat, and less, running commands in the background like bg, and getting system information like uptime, w, free, and top.

Uploaded by

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

Basic Linux Commands

This document provides summaries of basic Linux commands including mkdir to create directories, cd to change directories, mv to move or rename directories, pwd to print the working directory, rmdir to remove directories, chown to change file ownership and permissions, and ls to list directory contents. It also summarizes commands for copying files like cp, creating symbolic links like ln, finding files like locate, viewing file contents like more, cat, and less, running commands in the background like bg, and getting system information like uptime, w, free, and top.

Uploaded by

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

Basic Linux Commands

vlsijunction.com/2015/08/basic-linux-commands.html

Below are Basic command which may be useful for Physical Design Engineers while
working in Linux Environment

mkdir - make directories

Usagemkdir [OPTION] DIRECTORYOptionsCreate the


DIRECTORY(ies), if they do not already exist. Mandatory
arguments to long options are mandatory for short options too. -
m, mode=MODE  set permission mode (as in chmod), not
rwxrwxrwx - umask -p, parents  no error if existing, make parent
directories as needed -v, verbose  print a message for each
created directory -help display this help and exit -version output
version information and exit

cd - change directories

Use cd to change directories. Type cd followed by the name of a 


directory to access that directory.Keep in mind that you are always


in a directory and can navigate to directories hierarchically above
or below.

mv- change the name of a directory


Type mv followed by the current name
of a directory and the new
name of the directory. Ex: mv testdir newnamedir
pwd - print working directory
will show you the full path to
the directory you are currently in.
This is very handy to use, especially when performing some of the
other commands on this page 

rmdir - Remove an existing directory 

rm -r -Removes directories and files within the directories


recursively.

chown - change file owner and group


 permission  Specifies the rights that are being granted. Below is
the different rights that you can grant in an alpha  numeric
format.filenames  File or directory that you are associating the
rights with Permissions 

1/5
u - User who owns the file.
g - Group that owns the file.
o - Other.a - All.r - Read the file.
w - Write or edit the file.
x - Execute or run the file as a program.Numeric 
Permissions: CHMOD can also to attributed by using Numeric
Permissions:
400 read by owner040 read by group004 read by anybody (other)
200 write by owner020 write by group002 write by anybody100
execute by owner010 execute by group001 execute by anybody

ls - Short listing of directory contents


-a        list hidden files
-d        list the name of the current directory
-F        show directories with a trailing '/'            executable files
with a trailing '*'
-g        show group ownership of file in long listing
-i        print the inode number of each file
-l        long listing giving details about files  and directories
-R        list all subdirectories encountered
-t        sort by time modified instead of name          

cp - Copy files
cp  myfile yourfileCopy the files "myfile" to the file "yourfile" in the
current working directory. This command will create the file
"yourfile" if it doesn't exist. It will normally overwrite it without
warning if it exists.cp -i myfile yourfileWith the "-i" option, if the
file "yourfile" exists, you will be prompted before it is overwritten.

cp -i /data/myfileCopy the file "/data/myfile" to the current working


directory and name it "myfile". Prompt before overwriting the  file.

cp -dpr srcdir destdirCopy all files from the directory "srcdir" to


the directory "destdir" preserving links (-poption), file attributes (-
p option), and copy recursively (-r option). With these options, a
directory and all it contents can be copied to another dir

ln - Creates a symbolic link to a file.


ln -s test symlinkCreates a symbolic link named symlink that
points to the file test Typing "ls -i test symlink" will show the two

2/5
files are different with different inodes. Typing "ls -l test symlink"
will show that symlink points to the file test.locate - A fast
database driven file locator.

slocate -uThis command builds the slocate database. It will take


several minutes to complete this command.This command must
be used before searching for files, however cron runs this
command periodically  on most systems.locate whereis Lists all
files whose names contain the string "whereis". directory.

more - Allows file contents or piped output to be sent to the


screen one page at a time

less - Opposite of the more commandcat - Sends file contents to


standard output. This is a way to list the contents of short files to
the screen. It works well with piping.whereis - Report all known
instances of a command

wc - Print byte, word, and line counts

bg
bg jobs Places the current job (or, by using the alternative form,
the specified jobs) in the background, suspending its execution so
that a new user prompt appears immediately. Use
the jobs command to discover the identities of background jobs.

cal month year - Prints a calendar for the specified month of the


specified year.

cat files - Prints the contents of the specified files.clear - Clears


the terminal screen.

cmp file1 file2 - Compares two files, reporting all discrepancies.


Similar to the diff command, though the output format differs.

diff file1 file2 - Compares two files, reporting all discrepancies.


Similar to the cmp command, though the output format differs.

dmesg - Prints the messages resulting from the most recent


system boot.

3/5
fg
fg jobs - Brings the current job (or the specified jobs) to the
foreground.file files - Determines and prints a description of the
type of each specified file.find path -name pattern -printSearches
the specified path for files with names matching the specified
pattern (usually enclosed in single quotes) and prints their names.
The findcommand has many other arguments and functions; see
the online documentation.

finger users - Prints descriptions of the specified users.


free  - Displays the amount of used and free system memory.

ftp hostname Opens an FTP connection to the specified host,


allowing files to be transferred. The FTP program provides sub
commands for accomplishing file transfers; see the online
documentation.head files - Prints the first several lines of each
specified file.ispell files - Checks the spelling of the contents of
the specified files.

kill - signal process_ids

kill -l Kills the specified processes, sends the specified processes


the specified signal (given as a number or name), or prints a list of
available signals.killall program

killall - signal program Kills all processes that are instances of the


specified program or sends the specified signal to all processes
that are instances of the specified program.

mail - Launches a simple mail client that permits sending


and receiving email messages.man title man section title - Prints
the specified man page.ping host - Sends an echo request via
TCP/IP to the specified host. A response confirms that the host is
operational.

reboot - Reboots the system (requires root privileges).

shutdown minutes

shutdown -r minutesShuts down the system after the specified


number of minutes elapses (requires root privileges). The -r option
causes the system to be rebooted once it has shut down.

4/5
sleep time - Causes the command interpreter to pause for the
specified number of seconds.

sort files - Sorts the specified files. The command has many useful
arguments; see the online documentation.

split file - Splits a file into several smaller files. The command has
many arguments; see the online documentation

sync - Completes all pending input/output operations


(requires root privileges).

telnet host - Opens a login session on the specified host.

top - Prints a display of system processes that's continually


updated until the user presses the q key.trace route host - Uses
echo requests to determine and print a network path to the host.

uptime - Prints the system 

uptime.w - Prints the current system users.

wall - Prints a message to each user except those who've disabled


message reception. Type Ctrl-D to end the message.

5/5

You might also like