

Estude fácil! Tem muito documento disponível na Docsity
Ganhe pontos ajudando outros esrudantes ou compre um plano Premium
Prepare-se para as provas
Estude fácil! Tem muito documento disponível na Docsity
Prepare-se para as provas com trabalhos de outros alunos como você, aqui na Docsity
Encontra documentos específicos para os exames da tua universidade
Prepare-se com as videoaulas e exercícios resolvidos criados a partir da grade da sua Universidade
Responda perguntas de provas passadas e avalie sua preparação.
Ganhe pontos para baixar
Ganhe pontos ajudando outros esrudantes ou compre um plano Premium
Instructions on various unix commands used for file manipulation and access, including 'ls', 'wc', 'rm', 'mv', 'cp', and 'who'. It covers topics such as counting files, removing files, sorting user output, and changing directories.
Tipologia: Notas de estudo
1 / 2
Esta página não é visível na pré-visualização
Não perca as partes importantes!


a) echo * all the files b) echo [!0-9] all the files that don't end in a number, memo2.sv c) echo m[a-df-z] any file starting with an m followed by any lowercase letter other than e. d) echo [A-Z]* all files starting with an upper case letter e) echo jan* all files starting with jan f) echo . all files with a name that contains a. UNIX is not MS-DOS there is no need for a file to have a. in its name. g) echo ????? any file with a five character name h) echo * any file ending with 89 i) echo jan?? feb?? mar?? jan85 jan86 jan87 jan88 feb86 mar j) echo [fjm] [ae] [bnr] * feb86 jan12.89 jan19.89 jan26.89 jan5.89 jan85 jan86 jan87 jan88 mar
2-2. a) ls wc - Count the number of lines output by the ls command. This has the affect of counting how many files are in the current directory. When output from ls is sent to the screen it is usually put into columns. Whenever the output from ls is sent to a pipe it is sent one filename per line. Try the following commands ls and ls | cat Do you see the difference? b) rm ??? remove all files with three character filenames from the current directory c) who wc - Count the number of lines output by the who command. In effect this counts the number of users who are currently logged onto the computer. d) mv progs/* /usr/steve/backup Move all the files from the progs subdirectory into the directory /usr/steve/backup e) ls *.c wc - See a). This command counts the number of files with .c extensions in the current directory. f) rm *.o Remove all files with a .o extension from the current directory g) who sort Sort the output of the who command in alphabetical order. h) pwd Display the current working directory i) cp memo .. Copy the file memo1 into the parent directory j) plotdata 2>errors &
Run the program plotdata in the background and redirect standard error so that it is written to the file errors rather than to the screen. 2-3. a) no, to be able to obtain a directory listing a user needs to have read and execute access on a directory. b) yes, the user astaff has the required privileges because it is a member of the group owner. c) yes, astudent can obtain a directory listing. However if the other access permissions on the jonesd directory were changed so that others had no access at all astudent would not be able to get a directory listing of the docsdirectory. To access a subdirectory a user must have at least execute access on all the parent directories. d) yes, astudent can create a file in the docs directory. To be able to create a file in a directory you need write access. 2-4. a) 605 b) 777 c) 073 2-5. a) --x--x--x b) r-xr-x--- c) rwxr-x--- 2-6. If you can't see the value for shell by just typing set try one of the following commands: echo $SHELL echo $shell
2-7. Yes the shell variable should change if you run a different type of shell.
2-8. The output of the command echo Multiply is signified by the * symbol will be Multiply is signified by the file_list symbol where file_list will be all the filenames in the current directory.
2-9. The output of the following two lines string=hello there how are you echo $string will be hello The shell variable is assigned only the first word. The shell interprets the space after hello as separating out a command and ignores the rest of the arguments. Using quote characters as follows would have solved the problem string="hello there how are you"