Linux - File

About

The articles about Linux file management.

A full stop '.' before the name of the file makes it a hidden file. Example '.bash'

Articles Related

How to

filter a list of files ?

This command below gives you all files in the current directory which begin by elfutils.

[root@oel11g Server]# dir | grep -i elfutils
elfutils-0.137-3.el5.i386.rpm
elfutils-devel-0.137-3.el5.i386.rpm
elfutils-devel-static-0.137-3.el5.i386.rpm
elfutils-libelf-0.137-3.el5.i386.rpm
elfutils-libelf-devel-0.137-3.el5.i386.rpm
elfutils-libelf-devel-static-0.137-3.el5.i386.rpm
elfutils-libs-0.137-3.el5.i386.rpm

remove a file?

With the command rm

Example:

  • Basic
rm filename.extension
  • Prompts for confirmation before removing a file
rm -i filename.extension
  • Force removal of the file regardless of it bieng write-protected or open
rm -f filename.extension
  • Remove files recursively in 'directory'
rm -r directory

More … perform the man commando

man rm

List of command

  • ls - List contents of a directory
  • head - Displays first 10 lines of file
  • tail - Displays last 10 lines of file
  • mv - Moves or renames file
  • which - Displays path to command
  • whereis - locate the binary, source, and manual page files for a command
  • find - search for files in a directory hierarchy
  • locate - List files that match a pattern.

Locate all file with a regular expression. In this example all file which begin with sp and end up with the extension msb.

locate -r "sp.*\.msb"
  • cp - Copy one or more files to another location

Example: search for any file named root.sh on the current and all sub-directories.

find -name root.sh
  • Bookmark "Linux - File" at del.icio.us
  • Bookmark "Linux - File" at Digg
  • Bookmark "Linux - File" at Ask
  • Bookmark "Linux - File" at Google
  • Bookmark "Linux - File" at StumbleUpon
  • Bookmark "Linux - File" at Technorati
  • Bookmark "Linux - File" at Live Bookmarks
  • Bookmark "Linux - File" at Yahoo! Myweb
  • Bookmark "Linux - File" at Facebook
  • Bookmark "Linux - File" at Yahoo! Bookmarks
  • Bookmark "Linux - File" at Twitter
  • Bookmark "Linux - File" at myAOL
 
linux/file.txt · Last modified: 2012/04/22 21:16 by gerardnico