Question

In: Computer Science

List all files and directories in the current directory and store in a variable called malf....

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

Solutions

Expert Solution

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


Related Solutions

Display and store a long listing of all the regular files and directories in /personal_files. Store...
Display and store a long listing of all the regular files and directories in /personal_files. Store the output in a file called mypersonalfiles. UNIX
Unix ramdom question. How do you display a list of files in your current directory, sorted...
Unix ramdom question. How do you display a list of files in your current directory, sorted by file size with the largest files at the top.
UNIX treats file directories in the same fashion as files; that is, both are defined by...
UNIX treats file directories in the same fashion as files; that is, both are defined by the same type of data structure, called an inode. As with files, directories include a nine-bit protection string. If care is not taken, this can create access control problems. For example, consider a file with protection mode 644 (octal) contained in a directory with protection mode 730. How might the file be compromised in this case?
Unix treats file directories in the same fashion as files; that is, both is defined by...
Unix treats file directories in the same fashion as files; that is, both is defined by the same type of data structure, call an inode. As with files, directories include a non-bit protection string. If care is not taken, this can create access control problems. For example, consider a file with protection mode 644 (rw- r-- r--) contained in a directory with protection mode 730 (rwx -wx ---). How might the files be compromised in this case?
Java Programming: spellcheck Write code to read in a dictionary from the current directory called "dict.txt"...
Java Programming: spellcheck Write code to read in a dictionary from the current directory called "dict.txt" (you can find this in the current directory/data) Add each word to a hash map after splitting words and throwing away punctuation (see the demo). open a file called "spell.txt" to check in the current directory. Print out every word in spell.txt that is NOT in the dictionary. Example: if spell.txt contains: hello, this is a test. 2152189u5 Misspelled! cApitalized The output should be:...
Write a C++ app to read both files, store them into parallel vectors, sort the list...
Write a C++ app to read both files, store them into parallel vectors, sort the list of people in alphabetical order, display the new sorted list of names with their corresponding descriptions. Use the Bubble Sort strategy to rearrange the vector(s). File 1: Marilyn Monroe Abraham Lincoln Nelson Mandela John F. Kennedy Martin Luther King Queen Elizabeth II Winston Churchill Donald Trump Bill Gates Muhammad Ali Mahatma Gandhi Margaret Thatcher Mother Teresa Christopher Columbus Charles Darwin Elvis Presley Albert Einstein...
UNIX/LINUX SCRIPT: Create a named directory and verify that the directory is there by listing all...
UNIX/LINUX SCRIPT: Create a named directory and verify that the directory is there by listing all its contents. Write a shell script to validate password strength. Here are a few assumptions for the password string.   Length – a minimum of 8 characters. • Contain alphabets , numbers , and @ # $ % & * symbols. • Include both the small and capital case letters. give a prompt of Y or N to try another password and displays an error...
Given the directory /home/Kitty which contains the files timer.exe and bags.txt. Set the protection but such...
Given the directory /home/Kitty which contains the files timer.exe and bags.txt. Set the protection but such that; Give the commands that would change the permissions. It will be a Linux system Only the owner Kitty can execute timer.exe. Kitty’s default group can write to the directory, but no one can delete or move any file except Kitty.
there are files called LinkedList.h, and Array.h and all the functionality you need has already been...
there are files called LinkedList.h, and Array.h and all the functionality you need has already been implemented. There is also a file called TimeSupport.h that allows you to measure the running time of code segments. There is also a file called RandomSupport.h, which you can use to generate good random numbers. In your app.cpp , create a demo illustrating a scenario where storing numbers in a linked list is more efficient than an array. Your demo should generate a sufficiently...
Python programming Summary Store the times into arrays called Chevy[ ] and Ford[ ]. Then list...
Python programming Summary Store the times into arrays called Chevy[ ] and Ford[ ]. Then list the winner of each pair, giving the number of seconds the winner won by. At the end declare which team won based on which team had the most wins. Lab Steps There are eight cars in each team called Chevy and Ford. One car from each team races its opponent on the drag strip. Read in the racing times for the eight Chevy cars...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT