Class: Lt

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

Class Method Summary collapse

Class Method Details

.cat ⇒ Object



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

.cd ⇒ Object



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

.chmod ⇒ Object



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

.cp ⇒ Object



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

.date ⇒ Object



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

def self.date
  system("date")
end

.df ⇒ Object



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

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

.du ⇒ Object



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

.kill ⇒ Object



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

.ls ⇒ Object



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

def self.ls
  system("ls")
end

.mkdir ⇒ Object



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

.mv ⇒ Object



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

.passwd ⇒ Object



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

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

.ps ⇒ Object



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

def self.ps
  system("ps ")
end

.pwd ⇒ Object



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

def self.pwd
  system("pwd")
end

.rm ⇒ Object



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

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

.rmdir ⇒ Object



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

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

.who ⇒ Object



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

def self.who
  system("who")
end

.whoami ⇒ Object



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

def self.whoami
  system("whoami")
end