- Share this text:
Linux Command -Sorathiya Afroz - posted by guest on 10th February 2020 09:20:51 AM
192.168.0.132
$ mkdir work
$ ls
work
$ vi demo.sh
$ ls
demo.sh work
$ bash demo.sh
hello world
$ sh demo.sh
hello world
$ cat > abc.txt
hello world
how are you
i'm fine
and you ?
$ ls
abc.txt demo.sh work
$ cat abc.txt
hello world
how are you
i'm fine
and you ?
$ cat > demo1.sh
echo hello world;
echo how are you;
echo byyy;
$ ls
abc.txt demo1.sh demo.sh work
$ cat demo1.sh
echo hello world;
echo how are you;
echo byyy;
$ ls
abc.txt demo1.sh demo.sh work
$ bash demo1.sh
hello world
how are you
byyy
$ sh demo1.sh
hello world
how are you
byyy
$ vi demo2.sh
$ ls
abc.txt demo1.sh demo2.sh demo.sh work
$ bash demo2.sh
byyy
$ cat demo2.sh
#vhjfv
echo byyy;
$ cat > demo3.sh
#This is a Comment
echo 123456789
echo 987654321
$ ls
abc.txt demo1.sh demo2.sh demo3.sh demo.sh directory work xyz.txt
$ ls -l | cat > directory
$ cat directory
total 52
-rw-rw-r-- 1 1920BCA022 1920BCA022 36 Apr 25 07:05 abc.txt
-rw-rw-r-- 1 1920BCA022 1920BCA022 0 Apr 25 2011 demo1.sh
-rw-rw-r-- 1 1920BCA022 1920BCA022 18 Apr 25 2011 demo2.sh
-rw-rw-r-- 1 1920BCA022 1920BCA022 0 Apr 25 2011 demo3.sh
-rw-rw-r-- 1 1920BCA022 1920BCA022 24 Apr 25 2011 demo.sh
-rw-rw-r-- 1 1920BCA022 1920BCA022 0 Apr 25 07:23 directory
drwxrwxr-x 2 1920BCA022 1920BCA022 4096 Apr 25 2011 work
-rw-rw-r-- 1 1920BCA022 1920BCA022 17 Apr 25 07:07 xyz.txt
$mkdir Folder1 Folder2
$ ls
abc.txt demo2.sh demo.sh Folder1 work
demo1.sh demo3.sh directory Folder2 xyz.txt
$ cd Folder1
$ ls
$ cat > file1.txt
Hello
This is an Example
$ ls
file1.txt
$ wc -c file1.txt | cat > char_count.txt
$ ls
char_count.txt file1.txt
$ cat char_count.txt
25 file1.txt
$ wc -l file1.txt | cat > line_count.txt
$ wc -w file1.txt | cat > word_count.txt
$ ls
char_count.txt file1.txt line_count.txt word_count.txt
$ cat line_count.txt
2 file1.txt
$ cat word_count.txt
5 file1.txt
$ wc file1.txt | cat > count.txt
$ ls
char_count.txt count.txt file1.txt line_count.txt word_count.txt
$ cat count.txt
2 5 25 file1.txt
$ cp file1.txt copyiedfile.txt
$ ls
char_count.txt count.txt line_count.txt
copyiedfile.txt file1.txt word_count.txt
$ cat copyiedfile.txt
Hello
This is an Example
$ head -1 file1.txt
Hello
$ head -2 file1.txt
Hello
This is an Example
$ tail -1 file1.txt
This is an Example
$ tail -2 file1.txt
Hello
This is an Example
$ find file1.txt
file1.txt
$ find -type f
./char_count.txt
./copyiedfile.txt
./file1.txt
./line_count.txt
./count.txt
./word_count.txt