Class: Lt

Inherits:
Object
  • Object
show all
Defined in:
lib/linux-tools.rb

Class Method Summary collapse

Class Method Details

.catObject



12
13
14
15
16
# File 'lib/linux-tools.rb', line 12

def self.cat
  puts "please enter the filename"
  file = gets
  system("cat "+file)
end

.cdObject



6
7
8
9
10
# File 'lib/linux-tools.rb', line 6

def self.cd
  puts "this function is currently not operational"
  dir = gets
  system("cd "+dir)
end

.chmodObject



18
19
20
21
22
23
# File 'lib/linux-tools.rb', line 18

def self.chmod
  puts "Please enter the mode and the file/directory name(777 /some/directory)"
  file = gets

  system("chmod "+mode+" "+file)
end

.cpObject



25
26
27
28
29
# File 'lib/linux-tools.rb', line 25

def self.cp
  puts "please enter the source and destination"
  file = gets
  system("cp "+file)
end

.dateObject



31
32
33
# File 'lib/linux-tools.rb', line 31

def self.date
  system("date")
end

.dfObject



35
36
37
# File 'lib/linux-tools.rb', line 35

def self.df
  system("df -h")
end

.duObject



39
40
41
42
43
# File 'lib/linux-tools.rb', line 39

def self.du
  puts "Enter the path"
  path=gets
  system("du -h "+path)
end

.killObject



45
46
47
48
49
50
# File 'lib/linux-tools.rb', line 45

def self.kill
  system("ps -e")
  puts "Enter the process id to kill"
  pid=gets
  system("kill "+pid)    
end

.lsObject



2
3
4
# File 'lib/linux-tools.rb', line 2

def self.ls
  system("ls")
end

.mkdirObject



52
53
54
55
56
# File 'lib/linux-tools.rb', line 52

def self.mkdir
  puts"enter the path"
  mdir=gets
  system("mkdir "+mdir)
end

.mvObject



58
59
60
61
62
63
# File 'lib/linux-tools.rb', line 58

def self.mv
  puts"move from source to destination"
  sdir=gets
  ddir=gets
  system("mv "+sdir+" "+ddir)
end

.passwdObject



65
66
67
# File 'lib/linux-tools.rb', line 65

def self.passwd
  system("passwd "+gets)
end

.psObject



68
69
70
# File 'lib/linux-tools.rb', line 68

def self.ps
  system("ps ")
end

.pwdObject



72
73
74
# File 'lib/linux-tools.rb', line 72

def self.pwd
  system("pwd")
end

.rmObject



76
77
78
# File 'lib/linux-tools.rb', line 76

def self.rm
  system("rm "+gets)
end

.rmdirObject



80
81
82
# File 'lib/linux-tools.rb', line 80

def self.rmdir
  system("rmdir "+gets)
end

.whoObject



84
85
86
# File 'lib/linux-tools.rb', line 84

def self.who
  system("who")
end

.whoamiObject



88
89
90
# File 'lib/linux-tools.rb', line 88

def self.whoami
  system("whoami")
end