What Kind of Reality Check Do I Need Quiz
Q&A for How to Find a File in Linux
Coming soon
Search
-
QuestionWhat does the 'ls' command do?Community AnswerThe 'ls' command lists all files in the current directory you are working in. To find out what directory you are working in, type 'pwd' (stands for "print working directory").
-
QuestionWhich command will display the last ten lines of a file?Community AnswerYou have to used tail command to display the last lines of a file, the command used is, "tail -n filename." To display last 10 lines the command will be: tail -10 filename.
-
QuestionHow can I find a file in the root directory if I've forgotten the name and the directory in which it was placed?Living ConcreteTop AnswererYou can try searching for a file extension, or checking places where files are commonly saved, such as your home directory. If it's a text file, you can try using a recursive grep search ('grep -R') with text that you remember from the file as search criteria.
-
QuestionMy teacher wants me to use the command ls with ? to find certain files, but those file does'nt all have the same amount of charactere. How can I do?Nithik RCommunity AnswerUsing `ls` you can find files that contain the specific letters you specify. For example, you want to find all files in the directory that contain "abc" in their name, type " ls -d *abc* " It will list all matching files. But if you want to find files more recursively, type " find | grep -r "abc" " You may remove the "-r" if you don't want to search too deep.
-
QuestionI want to search a file test.sh in home dir . If this file exists, then we need to print the path or else we need to create a same test.sh file and need to write "hello" in the created file. How can we do?Nithik RCommunity AnswerTo find the file, type: `find ~/ -iname "test.sh" ` This will print the path to your file, if it exists. If you didn't find the file you are looking for, try searching in other places. To make a file and print hello, type this: ` touch test.sh ; echo "hello" > test.sh `
Ask a Question
200 characters left
Include your email address to get a message when this question is answered.
Submit