In: Computer Science
List all files and directories in the current directory and store in a variable called malf.
Count how many lines end with your firstname in the file /etc/conf
Explain this command: mv pmu*.[ab] cces/
Quick help in 5 min pleases with the UNIX program!
I want only the final answer
Please let me know if you need more information:-
======================================
List all files and directories :===> ls
List all files and directories including hidden files and
directories ===> ls -a
Example:-
===================
ss139t@ss139t:~$ ls
As2_sbah DownVote.sh FSUTIL ipv6_verify.py 'new 8.py' q105 Q49.py
Q5.sh q78 root_fil2 run_cmd.py sri srinu2 total.pl
createfile findDir.sh guess.cpp Module3 pdf_file.py Q2.sh Q4.sh q70
Q8.sh root_file shellScriptFunction.sh srinu ssr
ss139t@ss139t:~$ malf=`ls`
ss139t@ss139t:~$ echo $malf
As2_sbah createfile DownVote.sh findDir.sh FSUTIL guess.cpp
ipv6_verify.py Module3 new 8.py pdf_file.py q105 Q2.sh Q49.py Q4.sh
Q5.sh q70 q78 Q8.sh root_fil2 root_file run_cmd.py
shellScriptFunction.sh sri srinu srinu2 ssr total.pl
ss139t@ss139t:~$
==============
Including hidden files:-
==============
ss139t@ss139t:~$ malf=`ls -a`
ss139t@ss139t:~$ echo $malf
. .. As2_sbah .bash_history .bash_logout .bashrc .cache createfile
DownVote.sh findDir.sh FSUTIL .gnupg guess.cpp ipv6_verify.py
.lesshst .local Module3 new 8.py pdf_file.py .profile
.python_history q105 Q2.sh Q49.py Q4.sh Q5.sh q70 q78 Q8.sh
root_fil2 root_file run_cmd.py .selected_editor
shellScriptFunction.sh sri srinu srinu2 .ssh ssr
.sudo_as_admin_successful total.pl .viminfo
ss139t@ss139t:~$
==============
Count how many lines end with your
firstname in the file /etc/conf
=====
grep -w "firstname$" /etc/conf |wc -l
==
root@ss139t:/etc# cat /etc/conf
1how are you firstname
2 firstname dhshjjds
3djfjsdfhshf
4jsfskf firstname
5fdjsjfs firstname
6jfjsjnfs
7fsfs
8fsfsfsgfsg
9gsagfsgfsag firstname
root@ss139t:/etc# grep -w "firstname$" /etc/conf
1how are you firstname
4jsfskf firstname
5fdjsjfs firstname
9gsagfsgfsag firstname
root@ss139t:/etc# grep -w "firstname$" /etc/conf |wc
-l
4
root@ss139t:/etc#
===
==
Explain this command: mv pmu*.[ab] cces/
==
mv ==> move command
you need to under here is starting with ==>
pmu
and then fillowed by anything ==> *
(star)
and then follow by dot must be present ==> .
(dot)
and then must be with extension with letter a or b
==> [ab]
cces/ ==> this to to directory
See the below example
===
ss139t@ss139t:~/test$ ls -l
total 40
drwxrwxr-x 2 ss139t ss139t 4096 Mar 30 10:53 cces
drwxrwxr-x 2 ss139t ss139t 4096 Mar 30 10:50 pmua
drwxrwxr-x 2 ss139t ss139t 4096 Mar 30 10:50 pmub
drwxrwxr-x 2 ss139t ss139t 4096 Mar 30 10:50 pmud
-rw-rw-r-- 1 ss139t ss139t 0 Mar 30 10:53
pmujdj.a
drwxrwxr-x 2 ss139t ss139t 4096 Mar 30 10:53 pmujdj.afd
-rw-rw-r-- 1 ss139t ss139t 0 Mar 30 10:53
pmujdj.b
drwxrwxr-x 2 ss139t ss139t 4096 Mar 30 10:53 pmujdj.bfhs
drwxrwxr-x 2 ss139t ss139t 4096 Mar 30 10:51 pmujdj.hd
drwxrwxr-x 2 ss139t ss139t 4096 Mar 30 10:51 pmujdj.s
drwxrwxr-x 2 ss139t ss139t 4096 Mar 30 10:51 pmujdj.z
drwxrwxr-x 2 ss139t ss139t 4096 Mar 30 10:50 pmuz
ss139t@ss139t:~/test$ ls -l cces
total 0
ss139t@ss139t:~/test$ mv pmu*.[ab] cces/
ss139t@ss139t:~/test$ ls -l
total 40
drwxrwxr-x 2 ss139t ss139t 4096 Mar 30 10:54 cces
drwxrwxr-x 2 ss139t ss139t 4096 Mar 30 10:50 pmua
drwxrwxr-x 2 ss139t ss139t 4096 Mar 30 10:50 pmub
drwxrwxr-x 2 ss139t ss139t 4096 Mar 30 10:50 pmud
drwxrwxr-x 2 ss139t ss139t 4096 Mar 30 10:53 pmujdj.afd
drwxrwxr-x 2 ss139t ss139t 4096 Mar 30 10:53 pmujdj.bfhs
drwxrwxr-x 2 ss139t ss139t 4096 Mar 30 10:51 pmujdj.hd
drwxrwxr-x 2 ss139t ss139t 4096 Mar 30 10:51 pmujdj.s
drwxrwxr-x 2 ss139t ss139t 4096 Mar 30 10:51 pmujdj.z
drwxrwxr-x 2 ss139t ss139t 4096 Mar 30 10:50 pmuz
ss139t@ss139t:~/test$ ls -l cces
total 0
-rw-rw-r-- 1 ss139t ss139t 0 Mar 30 10:53
pmujdj.a
-rw-rw-r-- 1 ss139t ss139t 0 Mar 30 10:53
pmujdj.b
ss139t@ss139t:~/test$
==
Please let me know if you need more information.
====
Thanks