Which of the following commands will prevent any aliased options to the ls command?

The rm command is used to delete files.

Show

  • rm -i will ask before deleting each file. Some people will have rm aliased to do this automatically (type "alias" to check). Consider using rm -I instead, which will only ask once and only if you are trying to delete three or more files.
  • rm -r will recursively delete a directory and all its contents (normally rm will not delete directories, while rmdir will only delete empty directories).
  • rm -f will forcibly delete files without asking; this is mostly useful if you have rm aliased to ``rm -i'' but want to delete lots of files without confirming each one.

Removing troublesome files

Files with spaces or odd charactersPut single quotes round the filename to hide the space from the shell, you could escape the space with \ if you prefer. Or just start typing the name and hit Tab and the shell will do this for you.
For a filename which begins with a dash (-) you also need to precede the name with ./ to prevent it being treated specially.No such file or directoryIf this happens when trying to delete a file with a long name, it was probably displayed in truncated format. Press Tab to ask the shell to auto-complete the filename for you.Device or resource busyYou can't delete a file which is in use. Reboot the computer and try again. Or try to track down the processes which are using the file.
/usr/sbin/lsof filename
ps auxwww | grep process_id
# If the processes belong to you and you don't mind killing them
kill process_id
# Be more emphatic
kill -9 process_id

28/06/2016 Linux Essentials

1. Hidden files are files that begin with what character?

  • A dash (-)
  • A plus (+)
  • A period (.)
  • An asterisk (*)

2. What option for the ls command will display all files, including hidden files?

  • -L
  • -H
  • -w
  • -a

3. The top-level directory on a Linux system is represented as:

  • /
  • C:
  • /home
  • /root

4. Is the following path absolute or relative?. /etc/ppp

  • Absolute
  • Relative

5. Is the following path absolute or relative?. sysadmin/Documents

  • Relative
  • Absolute

6. Is the following path absolute or relative?. ../../home/sysadmin

  • Relative
  • Absolute

7. The tilde (~) is used to represent:

  • A user’s home directory
  • Any two single characters
  • The directory above the current working directory
  • Nothing; it has no special meaning

8. Which of the following commands can be used to access the home directory of the user “bob” while logged in as root?. (choose two)

  • cd /home/bob
  • cd ~bob
  • cd &&
  • ~bob

9. The double dot (..) can be used with the cd command to represent:

  • The directory above the current working directory
  • Nothing; it has no special meaning.
  • Any two single characters
  • A user’s home directory.

10. The cd command by itself will take you to what directory?

  • The system root directory
  • None; it is not a valid command
  • The directory above the current working directory
  • Your home directory

11. What command will allow you to change your current working directory?

  • chdir
  • list
  • cd
  • ls

12. The double dot (..) can be used to represent the directory…

  • …above the current directory.
  • …below the current directory.
  • …with any two single numbers.
  • …above the current directory only when using the cd command.

13. The ls command without options or arguments…

  • …generates an error as this command requires arguments.
  • …lists the contents of the current directory.
  • …prompts for a directory to list.
  • …lists the contents of a user’s home directory.

14. The first character in a long listing (ls -l) indicates:

  • The permissions
  • If something is a file, directory, or symbolic link
  • The owner
  • The size

15. Which option for the ls command, when used in conjunction with the -l option, will display human-readable sizes?

  • -M
  • -S
  • -H
  • -h

16. Which of the following commands will prevent any aliased options to the ls command?

  • /ls
  • %ls
  • %ls
  • ls

17. The ls command color codes results by default.. True or False?

  • True
  • False

18. The command ls -S will sort files:

  • By size, smallest to largest
  • By number of symlinks, largest to smallest
  • By modification date, newest to oldest
  • By size, largest to smallest

19. When using the cp command, you must provide both a source and a destination.. True or False?

  • True
  • False

20. Which option(s) can be used to prevent cp from overwriting an existing file?. (choose two)

  • -n
  • -N
  • -z
  • -i

21. The command rm -r will…

  • remove a directory along with any files or subdirectories.
  • prompt for each confirmation before deleting each file in a directory.
  • remove only empty directories.
  • generate an error; -r isn’t a valid option.

22. Which option can be used with the rm command to prompt before deleting?

  • -i
  • I
  • -P
  • A

23. The rm command can delete multiple files at once.. True or False?

  • True
  • False

24. Which of the following commands can be used to rename a file?

  • name
  • mv
  • rn
  • cp

25. The touch command can be used to:. (choose two)

  • Create new files
  • Change a file’s name
  • Update the time stamp of existing files
  • Change ownership of a file

Which of the following options for the ls command will show a listing of all files?

The ls command.
ls -a will list all files including hidden files (files with names beginning with a dot)..
ls -F gives a full listing, indicating what type files are by putting a slash after directories and a star after executable files (programs you can run)..
ls -l gives a long listing of all files..

Which of the following options for the Is command will show a listing of all files including hidden files?

The "ls" command has many options that, when passed, affect the output. For example, the "-a" option will show all files and folders, including hidden ones.

Which option can be used with the rm command to prompt before deleting?

Prompts you before deleting each file. When you use the -i and -r flags together, the rm command also prompts before deleting directories. If both the -i and -f flags are specified, the last one specified takes affect.

Which command S can be used to sort the lines of data file alphabetically and display it on the screen?

The sort command sorts the contents of a file, in numeric or alphabetic order, and prints the results to standard output (usually the terminal screen).

Which command can be used to print line numbers?

Which command can be used to print line numbers? The command echo "text" > file.