Linux Tutorial Part 2: Basic Linux Shell Skills 2


16. cat – catenates files

  • cat abc.txt – dumps the contents of ‘abc.txt’ to STDOUT
  • cat abc.txt def.txt dumps both files to STDOUT
  • cat abc.txt def.txt > abcdef.txt – creates new concatenated file
cat

17. mkdir – creates a new directory

18. cp – copies files

  • cp abc.txt testdir/
  • By default, ‘cp’ does NOT preserve the original modification time
  • cp -v def.txt testdir/

19. mv – moves files

  • mv abc.txt testdir/ – moves the file, preserving timestamp

20. rm – removes files/directories

  • rm abc.txt
  • rm -rf testdir – removes recursively and enforces

21. touch – creates blank file/updates timestamp

  • touch test.txt – will create a zero-byte file, if it doesn’t exist
  • touch def.txt – will update the timestamp
  • touch -t 201001011529 abcdef.txt – changes timestamp
rm,touch,ls

22. stat – reveals statistics of files

  • stat def.txt – reveals full attributes of the file

23. find – finds files using search patterns

  • find / -name ‘fstab’
  • Note: ‘find’ can search for fields returned by the ‘stat’ command

24. alias – returns/sets aliases for commands

  • alias – dumps current aliases
  • alias copy=’cp -v’
stat,find,alias

25. date – shows the current date and time.

 

Advertisements
Linux Tutorial Part 2: Basic Linux Shell Skills 2

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s