[go: up one dir, main page]

0% found this document useful (0 votes)
24 views4 pages

LINUX

The document provides information about various Linux commands and their usage: - It describes common file navigation commands like pwd, cd, ls, and mkdir to change directories, list files, and make new directories. - It also covers file manipulation commands such as touch to create files, cat to read/write file contents, grep to search files, and chmod to modify file permissions. - Additionally, it summarizes commands for archiving/compressing files like tar and gzip, getting system information with commands like date, cal, whoami, and commands for file searching, permissions management and process listing.

Uploaded by

Ullas Farm
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
24 views4 pages

LINUX

The document provides information about various Linux commands and their usage: - It describes common file navigation commands like pwd, cd, ls, and mkdir to change directories, list files, and make new directories. - It also covers file manipulation commands such as touch to create files, cat to read/write file contents, grep to search files, and chmod to modify file permissions. - Additionally, it summarizes commands for archiving/compressing files like tar and gzip, getting system information with commands like date, cal, whoami, and commands for file searching, permissions management and process listing.

Uploaded by

Ullas Farm
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 4

*pwd - present working directory

*cd - change the directory


$ cd /cygdrive/C/Users/manjusha/Desktop/Scaledge
$ cd /cygdrive/C/Users/manjusha/Desktop/Scaledge/'vlsi guru'
$ cd /cygdrive/C/Users/manjusha/Desktop/Scaledge/projects/FIFO/FIFO\ SYNC [feo each
space one / have to use]
$ cd .. -> comes to one folder back
$ cd ../.. -> jumps to two folders back
$ cd ~ -> jumps directly to homw directory

*tab - do auto fill


ls
*up & down arrow - to see previous commands

*ls - list all the files

*mkdir - make a directory


$ cd /cygdrive/C/Users/manjusha/Desktop
$ mkdir manju [this foler will show on desktop]

*$ touch hello.txt - used to create files


$ touch hell.txt go.doc heaven.pdf [create multiple files]

*$ cat hell.txt - read the contents in that file

*$ cat>hello.txt - overwrite the existing content in that file [> - redirect


symbol]
manjusha is studying mtech

press CTRL + D to exit from write mode

*ls *.txt - list all text fies


=================================================================================
//JUNE 21
ls
ls *.txt - displays all the files with the extension .txt
* called as wildcard

===================================================================================
===
//june 22,2022
* vi hi.txt - edit the file
learn gvim commands

*grep - used to search the content or pattern in the text file


$ grep "you" hell.txt

*chmod - change mode


$ chmod 777 hell.txt -> all permisions
u - user, g - group, o - others
$ chmod ugo+x hello.txt - give all permissions
$ chmod ugo-x hello.txt - remove all permissions

* nl - display the line numbers of the file


$ nl hell.txt

1 hi manju. how are you?


2 you
*uniq - displays by remove the continues duplicate content in the file (report or
omit repeated lines)
eg: h1.txt -
hi
hi
$ uniq h1.txt -> output: hi
$ man uniq - manual of the command "uniq"
eg: h1.txt -
hi
get
hi
$ uniq -c hello.txt - (count) prefix lines by the no. of occurences, output:

1 hi
1 get
1 hi

$ uniq -d hello.txt - only print duplicate lines, one for each group

*wc - gives count of lines, words and characters


$ cat>hell.txt
this is manjusha. i am studying mtech in jntuA.
I AM SO HAPPY.
i hope u r also doing the same

manjusha@DESKTOP-GG5F932 /cygdrive/C/Users/manjusha/Desktop/hi
$ wc hell.txt
3 21 94 hell.txt

*rm - remove a file


*rmdir - remove directory
*date - day, date, time
*cal - calendar
*cp - copy one file into another
* ls -r -> list the files
ls -h -> human readable form -15k
ls -t -> based on time
ls -ltr -> reverse based on time
ls -ltrh -> reverse based on time in human readable form -15k
*mkdir -p a/b/c/d -> creates a directories in other directory , a is parent
directory
*head --> Display the top 10 files in the file
* tail <file name>--> Display the bottom 10 lines in the file.
* more <file name> -> similar to cat ,but it display with larger content.
*less <file name> --> Display the less content.
*id --> Display the id user (or) group.
*ping --> check the network connectivity /status of network/server.
*history --> Review all the commands which we have entered.
*hostname --> Display the hostname/username/Domain name.
*hostname -I --> Display the all ip addresses for the host.
*hostname -i --> Display the ip address for the host.
*mv <filename1> <filename2> - used to rename the file (filemname1 is changed to
filename2)
*diff <filename1> <filename2> -> compares the content of two different files,
common content will be removed, display the content which is different from both
the files.
* -c -> displays the change in the both files

*cmp <filename1> <filename2> -> compare the text in both the files byte by byte and
displays the differ: char no. line no. It won't display anything if the contents
get matched.
*sort <filename>- it displays the content by sorting all the lines in the file in
an alphabetical order based on the 1st charater in each line. But it won't change
the order in the file.
* tac <filename1> -> diplays the content in the reverse order
* exit - to logout
*!! -> repeats last command

// COMPRESSION COMMANDS
*tar cf name.tar <filenames----> -> create a name.tar file
**tar xf name.tar -> extract the files from name.tar file
*tar czf name.tar.gz <filenames----> -> create a name.tar file with gzip
compression
**tar xzf name.tar.gz -> extract the files from name.tar file with gzip compression
*tar cjf name.tar.bz2 <filenames----> -> create a name.tar file with Bzip2
compression
**tar xjf name.tar.bz2 -> extract the files from name.tar file with Bzip2
compression
* gzip <filename> -> compress the file and renames it to filename.gz
*gzip -d filename.gz -> decompress the filename.gz to filename

//SYSTEM INFO
date - shows date and time
cal - shows this months cal
whoami - who you are logged in as
finger user - displays info about user
uname -a -> shows kernel info
man definition - an interface to the system reference manuals
man <command> - shows manual for the command
eg: man ls -> shows manual for lsq
df - shows disk usage
du - shows directory space usage

//SEARCHING
grep "pattern" <filename> - seach for pattern in that file name
grep -r "pattern" <dirname> - seach recursively for pattern in that dir
command | grep "pattern" - search pattern in the output of the comamnd
eg :cat k1.txt | grep "hi"
hi baby
//FILE PERMISSION
chmod octal file - change tthe permission of file to octal which can be found
separately for user, group, world by adding,
4-read(r), 2-write(w) ,1-execute(x)
eg:$ls -all
-rw-r--r--+ 1 manjusha None 4 Nov 27 22:04 h4.txt
-rw-r--r--+ 1 manjusha None 14 Nov 27 23:30 k1.txt
-rw-r--r--+ 1 manjusha None 21 Nov 27 23:31 k2.txt
-rw-r--r--+ 1 manjusha None 10240 Nov 27 22:58 man.tar
-rw-r--r--+ 1 manjusha None 148 Nov 27 23:04 man.tar.bz2
-rw-r--r--+ 1 manjusha None 136 Nov 27 23:02 man.tar.gz
-rw-r--r--+ 1 manjusha None 42 Nov 27 21:50 sv.txt
-rwxrwxrwx+ 1 manjusha None 36 Nov 27 21:52 verilog.txt.gz

manjusha@DESKTOP-GG5F932
/cygdrive/C/Users/manjusha/OneDrive/Desktop/Practice/linux_prac
$ chmod 422 k1.txt

manjusha@DESKTOP-GG5F932
/cygdrive/C/Users/manjusha/OneDrive/Desktop/Practice/linux_prac
$ ls -all
total 27
drwxr-xr-x+ 1 manjusha None 0 Nov 27 23:10 .
drwx------+ 1 manjusha None 0 Nov 27 09:23 ..
-rw-r--r--+ 1 manjusha None 4 Nov 27 22:04 h4.txt
-r---w--w-+ 1 manjusha None 14 Nov 27 23:30 k1.txt
-rw-r--r--+ 1 manjusha None 21 Nov 27 23:31 k2.txt
-rw-r--r--+ 1 manjusha None 10240 Nov 27 22:58 man.tar
-rw-r--r--+ 1 manjusha None 148 Nov 27 23:04 man.tar.bz2
-rw-r--r--+ 1 manjusha None 136 Nov 27 23:02 man.tar.gz
-rw-r--r--+ 1 manjusha None 42 Nov 27 21:50 sv.txt
-rwxrwxrwx+ 1 manjusha None 36 Nov 27 21:52 verilog.txt.gz

manjusha@DESKTOP-GG5F932
/cygdrive/C/Users/manjusha/OneDrive/Desktop/Practice/linux_prac
$ cat k1.txt
hi baby
buddy

manjusha@DESKTOP-GG5F932
/cygdrive/C/Users/manjusha/OneDrive/Desktop/Practice/linux_prac
$ cat >k1.txt
-bash: k1.txt: Permission denied

//PROCESS MANAGEMENT
ps ->display the currently working processes

//file commands
rm file - remove a file
rm -r dir -> remove dir
rm -f file ->force to remove a file
rm -rf dir ->force to remove dir
cp file1 file2 -> copy file1 to file2
cp -r dir1 dir2 -> copy dir1 to dir2
mv file1 file2 -> remove or move
ln -s file link ->create symbolic link to file

You might also like