13 Answered Questions for the topic file

How to create a file in Linux from terminal window?

What's the easiest way to create a file in Linux terminal?


Convert DOS line endings to Linux line endings in vim?

If I open files I created in Windows, the lines all end with `^M`. How do I delete these characters all at once?


Quickly create a large file on a Linux system?

How can I **quickly** create a large file on a Linux ([Red Hat Linux][1]) system? [dd][2] will do the job, but reading from `/dev/zero` and writing to the drive can take a long time when you need... more
File Python


How do I remove/delete a folder that is not empty with Python?

I am getting an 'access is denied' error when I attempt to delete a folder that is not empty. I used the following command in my attempt: `os.remove("/folder_name")`. What is the most effective way... more


How to append one file to another in Ubuntu Linux?

I have two files: `file1` and `file2`. How do I append the contents of `file2` to `file1` so that contents of `file1` persist the process?


Why should text files end with a newline?

I assume everyone here is familiar with the adage that all text files should end with a newline. I've known of this "rule" for years but I've always wondered — why?
File Unix Bash


How to split a large text file into smaller files with equal number of lines?

I've got a large (by number of lines) plain text file that I'd like to split into smaller files, also by number of lines. So if my file has around 2M lines, I'd like to split it up into 10 files... more
File Linux Symlink


Remove a symlink to a directory?

I have a symlink to an important directory. I want to get rid of that symlink, while keeping the directory behind it. I tried `rm` and get back `rm: cannot remove 'foo'`. I tried `rmdir` and got... more


Copying files across computers using SSH and MAC OS X Terminal?

I'm trying to copy my .profile, .rvm and .ssh folders/files to a new computer and I know how to use the `cp` and `ssh` commands but I'm not sure how to use them in order to transfer files from one... more
File Linux Unix Path


How to get full path of a file?

Is there an easy way I can print the full path of `file.txt` ? file.txt = /nfs/an/disks/jj/home/dir/file.txt The `<command>` dir> <command> file.txt should print ... more


How do I copy a file in Python?

How do I copy a file in Python?I couldn't find anything under [`os`](https://docs.python.org/2/library/os.html).


How to read a file line-by-line into a list?

How do I read every line of a file in Python and store each line as an element in a list? I want to read the file line by line and append each line to the end of the list.
File Python Append


How do you append to a file in Python?

How do you append to the file instead of overwriting it? Is there a special function that appends to the file?

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.


Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.